While debugging a videogame in OpenGl C++ I printed the transformation/translate matrix and show me something like this:
1 0 0 0
0 1 0 0
0 0 1 0
tx ty tz 1
but I think it should be:
1 0 0 tx
0 1 0 ty
0 0 1 tz
0 0 0 1
This is the code:
glm::mat4 transform;
transform = glm::mat4();
unsigned int transformLoc = glGetUniformLocation(this->shaderProgram, "transform");
transform = glm::translate(transform, glm::vec3(5.0, 0.0, 1.0));
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
std::cout << transform[i][j] << " ";
}
std::cout << std::endl;
}
And prints:
1 0 0 0
0 1 0 0
0 0 1 0
5 0 1 1
New contributor
caquis caquis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.