what is the matrix get from getModelViewMatrix()

Hi All,

recently i’m learning cinder and thinking deeper on openGL part as well, and find the the matrix get from function getModelViewMatrix() (cinder and ofx has the same name) is so different, for example, if i set my eye position is (0, 0, -450), seems the matrix from cinder is:
1 0 0 0
0 -1 0 0
0 0 1 -450
0 0 0 1

looks like the OpenGL tutorial’s format, the last column means x, y, z of eye position.

but the matrix get from ofx is:
0.845905 -0.153252 0.510840 0.000000
0.000000 0.957826 0.287348 0.000000
-0.533333 -0.243069 0.810230 0.000000
-239.999878 -109.381088 -888.233643 1.000000
this looks quite confusing how did i get such matrix.

anyone has an idea about this?

Cheers,
Pengfei

just find a function from ofMatrix4f called makeLookAtViewMatrix(), which could produce a same matrix as read from opengl using function:
float matrixData[16];
glGetFloatv(GL_MODELVIEW_MATRIX, matrixData);
which i think is also what shader would receive.
when i looked into ofCamera class, I found its usmakeInvertOf(getGlobalTransformMatrix()) to get the modelviewmatrix which would produce something i have no idea, but i think is not the matrix same with gl_ModelViewMatrix in glsl.

Just start get deeper in this part, if there are something wrong when i’m describing the question, please figure it out. Cheers.

Sorted… quite simple, ofCamera only load the matrix when it runs begin, but not setupPerspective or lookat, I get the matrix when it hasn’t load the matrix, that’s why i got a wrong one.
But it’s not a waste of time, because it means ofCamera.begin() should be used before you run your shader, otherwise maybe arouse some problem.