PDA

View Full Version : why does glGetFloatv(GL_MODELVIEW_MATRIX) return Identity matrix...?



tinman
10-25-2001, 03:59 AM
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...

-Tin

GameMaker
10-25-2001, 05:52 AM
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.

Korval
10-25-2001, 11:24 AM
Try the following code snippet:

glMatrixMode(GL_MODELVIEW);
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.

tinman
10-25-2001, 12:20 PM
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...

Thanks.