Imagination PowerVR SDK Blog

Weird stuff with glGetFloatv


#1

Hi all,
I have the following code (OpenGL ES 1.1, SDK ver. 2.4, WindowsXP):

void func_1()
{
     .
     .
     .
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();

     glPushMatrix();
          glRotatef(-90.0, 1.0, 0.0, 0.0);
          glRotatef(-90.0, 0.0, 0.0, 1.0);
          func_2();
     glPopMatrix ();
}

void func_2()


{


     glPushMatrix();


            glGetFloatv(GL_MODELVIEW_MATRIX, debug_matrix);
            glMultMatrixf(my_matrix);
            draw_model();
     glPopMatrix ();


}

So the issue is that if I comment out the “glGetFloatv(GL_MODELVIEW_MATRIX, debug_matrix);” call, I get completly different results (wrong results). I seems like the rotations in func_1 have no effect if the glGetFloatv is commented, which seems illogical to me. my_matrix does not get multiplied with the rotation matrix which is setup in func_1. What exactly does glGetFloatv do? Does it modify the matrix stack in any way?
This bugs me several days now and I’m real close to insanity :). Any help will be greatly appreciated.
Also, can I get debug version of libgles_cm.dll to see what’s happening in that function?

Thanks, Emil.


#2

This is actually a known issue (BRN27265) and has been fixed for our next release.





Putting a glGetFloatv() in like you have is actually the recommended work-around for this problem at the moment, though.


#3

Ok, thanks Gordon,
I’ll be waiting for the next release than.