I'm tinkering with OpenGL using glfw, glad, and glm. In one of the tutorials I'm using, they demonstrate some simple usage of glm as so:
glm::vec4 vec(1.0f, 0.0f, 0.0f, 1.0f);
glm::mat4 trans;
trans = glm::translate(trans, glm::vec3(1.0f, 1.0f, 0.0f));
vec = trans * vec;
std::cout << vec.x << vec.y << vec.z << std::endl;
When I compile and run this code, I get trash values (usually NAN). The tutorial specifically noted that instantiating
glm::mat4 trans;
would by default create an identity matrix for the varialbe "trans". I'm thinking that perhaps this is the issue, though I have verified that glm does do this by default.
In case it would be helpful, you can find the entire source file here on line 308. I greatly appreciate your time!
See Question&Answers more detail:os