I am using a 4x4 matrix to transform verts in a shader. I multiply an identity matrix by a rotation matrix by a translation matrix. I am trying to first rotate the verts and then translate them, however in my result, it appears that the verts are being transformed and then rotated.

My matrix looks something like this:

m00 m01 m02 tx
m10 m11 m12 ty
m20 m21 m22 tz
--- --- --- 1

I am not using OpenGL's fixed function pipeline, I am multiplying matrices on the client side, and uploading the matrix to a GLSL shader.

If it helps, I am using my own matrix multiplication code, but I have recreated this problem using matrices on my graphing calculator, so I don't believe my matrix code has errors..

I'll include a visual aid if needed.


Mutliply the translation matrix with the rotation matrix, not the other way around. You dont need to multiply with the identity matrix at all, that has no effect, it is like multiplying any number with 1, it wont change the number and the matrix.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.