#123950 - 3D_geek - Mon Apr 02, 2007 12:17 am
In glGetFixed we have:
case GL_GET_MATRIX_PROJECTION:
glMatrixMode(GL_POSITION);
....
and then:
case GL_GET_MATRIX_POSITION:
glMatrixMode(GL_PROJECTION);
....
I kinda assume these are swapped! I think there are other problems in that function also...
#123969 - gabebear - Mon Apr 02, 2007 6:08 am
Those parts of the function are correct, but there is one other big problem with that function; the clip matrix is named the modelview matrix. The position matrix is basically the equivalent of OpenGL's modelview.
I'm fixing this right now.
#123970 - 3D_geek - Mon Apr 02, 2007 6:15 am
gabebear wrote: |
Those parts of the function are correct, but there is one other big problem with that function; the clip matrix is named the modelview matrix. The position matrix is basically the equivalent of OpenGL's modelview.
I'm fixing this right now. |
The projection matrix gets the position matrix and the position matrix gets the projection...that's **RIGHT** !?!? Surely not!
#123971 - gabebear - Mon Apr 02, 2007 6:55 am
I've been meaning to update the modelview name to clip. If you look at the function it makes sense; here is some of the code with updated names.
Code: |
case GL_GET_MATRIX_POSITION:
glMatrixMode(GL_PROJECTION);
glPushMatrix(); // save the current state of the projection matrix
glLoadIdentity(); // load a identity matrix into the projection matrix so that the clip matrix = position matrix
while(GFX_BUSY); // wait until the graphics engine has stopped to read matrixes
for(i = 0; i < 16; i++) f[i] = MATRIX_READ_CLIP[i]; // read out the position matrix
glPopMatrix(1); // restore the projection matrix
break;
|
The clip matrix is calculated by multiplying the projection matrix by the position matrix. If you want to read just one of these then you need to set the other matrix to identity.
#124044 - 3D_geek - Mon Apr 02, 2007 7:26 pm
Ah - wait...I see the problem. It changes the glMatrixMode behind your back without restoring it...that's what's fscking me. I was assuming it was giving me the wrong matrix - in fact it was leaving me altering the wrong matrix.
Mmm'K thanks!