Results 1 to 4 of 4

Thread: glGetFloatv(GL_MODELVIEW_MATRIX, m)

  1. #1
    Senior Member Regular Contributor
    Join Date
    Feb 2003
    Location
    Westerville, Oh, USA
    Posts
    201

    glGetFloatv(GL_MODELVIEW_MATRIX, m)

    Which matrix is put in m, the one that was pushed on the matrix stack, or the one with the translation and rotation applied to it:

    glPushMatrix();
    glRotatef(30.0f, 0., 1., 0.);
    glTranslatef(100.0f, 0., 0.);
    float m[16];
    glGetFloatv(GL_MODELVIEW_MATRIX, m);
    glPopMatrix();

    I have code similar to this and m contains all zeros except for m[15], which contains 1.0. Any ideas?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: glGetFloatv(GL_MODELVIEW_MATRIX, m)

    The current one. In this case, the one with the Rotate and translate.
    Deiussum
    Software Engineer and OpenGL enthusiast

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Nov 2002
    Location
    Latvia
    Posts
    626

    Re: glGetFloatv(GL_MODELVIEW_MATRIX, m)

    & if you had trans & rot's before pushing they are in the m too!

  4. #4
    Senior Member Regular Contributor
    Join Date
    Feb 2003
    Location
    Westerville, Oh, USA
    Posts
    201

    Re: glGetFloatv(GL_MODELVIEW_MATRIX, m)

    I think I figured out my problem (unfortunately, I'm at work and my code is at home :< ). This is a planet/moon system, and my camera orbits along with one of the moons. Well, the "eye" and "look" parameters to gluLookAt are calculated from the moon and planet positions, which aren't initialized (and that's the bug). So eye and look are both zero vectors, making the initial modelview matrix after gluLookAt() all zeros. Thus, subsequent transformations don't do anything, and when I get the planet and moon's new positions after the translate/rotate, they're still zero vectors and the cycle continues. All I need to do is intialize the planet and moon positions.

    Learning the hard way is still learning, right?


    [This message has been edited by starman (edited 06-19-2003).]

Similar Threads

  1. GL_MODELVIEW_MATRIX vs. gl_ModelViewMatrix
    By Rhawk187 in forum OpenGL: GLSL
    Replies: 0
    Last Post: 02-20-2010, 07:12 PM
  2. Get true location by glGetFloatv(GL_MODELVIEW_MATRIX, mat)?
    By tgtt in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-23-2004, 03:04 AM
  3. glGetFloatv(GL_MODELVIEW_MATRIX, mat)?
    By tgtt in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 02-22-2004, 11:34 PM
  4. Replies: 0
    Last Post: 02-20-2004, 09:06 PM
  5. Replies: 3
    Last Post: 10-25-2001, 01:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean