matrix 4x4 position data

Posted by freefallr on Game Development See other posts from Game Development or by freefallr
Published on 2011-11-26T23:26:38Z Indexed on 2011/11/27 2:03 UTC
Read the original article Hit count: 345

Filed under:
|
|

I understand that a 4x4 matrix holds rotation and position data.

The rotation data is held in the 3x3 sub-matrix at the top left of the matrix.

The position data is held in the last column of the matrix.

e.g.

glm::vec3 vParentPos(
    mParent[3][0], 
    mParent[3][1], 
    mParent[3][2] 
);

My question is - am I accessing the parent matrix correctly in the example above? I know that opengl uses a different matrix ordering that directx, (row order instead of column order or something), so, should the mParent be accessed as follows instead?

glm::vec3 vParentPos(
    mParent[0][3], 
    mParent[1][3], 
    mParent[2][3] 
);

thanks!

© Game Development or respective owner

Related posts about opengl

Related posts about matrix