i get this error while trying multiply matrix and vector with GLM following this tutorial.
reading1.cpp: In function ‘int main()’:
reading1.cpp:50:44: error: conversion from ‘glm::detail::tmat4x4<int>’ to non-scalar type ‘glm::mat4 {aka glm::detail::tmat4x4<float>}’ requested
I am using this command to compiling.
g++ 1.cpp -o 1 -lGLEW -lglfw
#include <glm/glm.hpp>
#include <glm/gtx/transform.hpp>
//program
glm::mat4 myMatrix = glm::translate(10,0,0);
glm::vec4 myVector(10,10,10,0);
glm::vec4 transformedVector = myMatrix * myVector;
//program
I’ve found GLM to be very picky about types due to the heavy use of templates. My guess is that either your vec4 or mat4 are creating
inttypes, and notfloat.Try creating them with floats explicitly, as it won’t autoconvert them if there are int constuctors available that match the template.