Results 1 to 5 of 5

Thread: Obtaining the modelview matrix

  1. #1
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    21

    Obtaining the modelview matrix

    What structure do I have to use to get the modelview matrix by glGetDoublev. I have tried this one:

    GLdouble *mat;

    mat = new GLdouble[16];
    glGetDoublev(GL_MODELVIEW_MATRIX, mat);

    but it didn't work, then I also tried this:

    GLdouble mat[16];

    glGetDoublev(GL_MODELVIEW_MATRIX, mat);

    What do I have to do?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Dec 1969
    Location
    Munich,Germany
    Posts
    227

    Re: Obtaining the modelview matrix

    could u poast some more code you are using around the glGetDoublev


    Chris
    yes

  3. #3
    Junior Member Newbie
    Join Date
    May 2001
    Location
    Evanston, IL, USA
    Posts
    3

    Re: Obtaining the modelview matrix

    I hope this helps with your program. I am working with the same call on my program right now. This is what I am using, so maybe if would work for you also.

    glPushMatrix();
    GLdouble modelMatrix[15];
    for (int i = 0; i < 16; i++)
    {
    modelMatrix[i] = 0;
    }
    glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);

    A couple of things: before you get the matrix you need to push it, because getting it takes the top matrix off the stack (not just copies it), also, I think you need to initialize the variable that you are passing it into. Good luck, I hope this helps.

  4. #4
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    21

    Re: Obtaining the modelview matrix

    Hi folks.

    I found out what it was. You have to call the glutCreateWindow() first. What is this function does that makes it work?

    Besides, you don't need to initialize your variable, nor do need to push the matrix.

    Thanx, anyway.


    [This message has been edited by martinjy (edited 05-29-2001).]

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

    Re: Obtaining the modelview matrix

    Before any openGL function can be used, the pixelformat of the window has to be setup to use OpenGL. glutCreateWindow does that for you, thus, you have to do that before any of your gl* calls will be valid.
    Deiussum
    Software Engineer and OpenGL enthusiast

Similar Threads

  1. Obtaining normal Matrix for 1.3+ shader
    By Zylzyl in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 01-15-2014, 12:41 PM
  2. Obtaining projection Matrix, from Intrinsic Matrix
    By prash_prash in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 08-29-2011, 06:36 AM
  3. Lightning: ModelView matrix or just Model Matrix?
    By bliss in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-14-2011, 02:38 PM
  4. Obtaining a referece to current matrix
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-12-2003, 09:25 PM
  5. Difference between Modelview matrix and projection matrix
    By aphlai in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-22-2001, 07:22 AM

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