Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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