Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

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

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2001
    Posts
    6

    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...

    -Tin

  2. #2
    Intern Contributor
    Join Date
    Apr 2002
    Posts
    94

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

    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.
    P4 2Ghz, GEFORCE4, 512 Meg RAM, WIN2000, VStudio 6.0

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,576

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

    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.

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2001
    Posts
    6

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

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •