Correct Rotation and Translation with a 4x4 matrix
Posted
by
sFuller
on Game Development
See other posts from Game Development
or by sFuller
Published on 2012-09-01T17:11:26Z
Indexed on
2012/09/01
21:50 UTC
Read the original article
Hit count: 347
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.
© Game Development or respective owner