why does glGetFloatv(GL_MODELVIEW_MATRIX) return Identity matrix...?

I decided to post this question in the beginners forum in the fear of getting flamed in the advanced forum…

Anyway, as the subject header implies, my problem is that glGet…(GL_MODELVIEW_MATRIX) keeps returning an identity matrix, and that’s quite annoying!

…I’ve read a recent post, however, and may decide to keep my own matrix of transformations instead anyway…but was just wondering…


From what I have heard, keeping your own matrix is faster than calling glGetFloatV every frame on the MODELVIEW matrix.

I don’t know why you would get the identity matrix though.

Try the following code snippet:

glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
glGetFloatv(GL_MODELVIEW_MATRIX, &matrix);

If this doesn’t get something that is not identity, then I can’t explain the problem.

However, if you are getting a non-identity matrix, then your problem is that you’re resetting the modelview matrix somewhere before the glGet.

Yes!..I get it now…D’oh!..I haven’t tried it yet, but I’m sure that I know where I’m going wrong now…