Is Matrix3x3 column-major or row-major?

Post Reply
d3x0r
Posts: 51
Joined: Tue Dec 11, 2012 9:59 pm

Is Matrix3x3 column-major or row-major?

Post by d3x0r »

Recent sources from github have a function that is

childTrans.getOpenGLMatrix(childMat);

which does a transpose on the matrix for the result; however, the resulting matrix is never passed to opengl in examples. Instead Identity matrix is used for opengl and the matrix is applied to coordinates as they are drawn instead.

I finally implemented shaders that use worldview and modelview to result in a translation and have learned that the two matrixes are transposes of each other.... so I have two routines GetCameraOpenGLMatrix and GetOpenGLMatrix() the first is passed as worldview and the second as modelview.

gl_postion = projection * worldview * modelview * vertex;

the example code uses btVector3 dx(m[0], m[1], m[2]); which I guess since it was transposed to get there, that the matrix is naturally column-major...

basically X * column(0) is the translated X... basically that the X axis of a rotation is represented by the first column of the matrix ?
d3x0r
Posts: 51
Joined: Tue Dec 11, 2012 9:59 pm

Re: Is Matrix3x3 column-major or row-major?

Post by d3x0r »

I guess I could evaluate the quaternion code for more confirmation...

from the quaternion conversion it looks more like it's row-major. so btVector3 m_el[3]; m_el[0] is the x-axis translation then?

which would align with other comments that said it was inversed from opengl method, and why the getopenglmatrix does a transpose....

but that's only needed for the worldview matrix (camera translation)
Post Reply