Results 1 to 6 of 6

Thread: display lists off their positions

  1. #1
    Senior Member Regular Contributor
    Join Date
    Aug 2000
    Location
    Los Angeles, CA, USA
    Posts
    101

    display lists off their positions

    Hi,

    I create display lists first. And next time when I have a chance to render (i.e. the original rendering context becomes current), I call glCalllist. But the objects in the display lists are rendered off their right position. I am very new to display lists. Can someone give me any hit leading the possibility finding what I have missed? Your help is much appreciated.

    JD

  2. #2
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: display lists off their positions

    Reset the modelview matrix calling glLoadIdentity() to prevent the display list data from being affected by previous transformations.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Aug 2000
    Location
    Los Angeles, CA, USA
    Posts
    101

    Re: display lists off their positions

    Hi dletozeun,

    Thanks for the reply. Should I call glLoadIdentity() right before calling glCallList() or right before calling glGenLists()? Your further help is much appreciated.

    JD

  4. #4
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: display lists off their positions

    Reset the modelview matrix before calling glCallList().
    To preserve the matrix state before drawing the display list you can also use the glPush/glPop command and do something like:

    Code :
    glMatrixMode( GL_MODELVIEW );
     
    // Save the current modelview matrix pushing it in the stack
    glPushMatrix();
    // Reset the transformation
    glLoadIdentity();
    // draw stuff
    glCallList( list_name );
    // Restore the last matrix state
    glPopMatrix();

  5. #5
    Senior Member Regular Contributor
    Join Date
    Aug 2000
    Location
    Los Angeles, CA, USA
    Posts
    101

    Re: display lists off their positions

    I am puzzled why we call glLoadIdentity for glCallList rather than for glNewList. I thought that we should have identity model view matrix during creating a list. Later, we can call the list for whatever the current model view matrix is. For example, we create a list for draw a basketball under an identity model view. And later, we can call the list and the ball will show up according to how we rotate and translate the model view. Any further help is much, much appreciated.

    JD

  6. #6
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: display lists off their positions

    If you already set the matrix in the display list, in that case it is probably not the problem.
    As you said you can set the matrix transformation once and for all when creating the display list but that does not prevent from being affected by transformation set outside if you do not take some precautions.

Similar Threads

  1. cg & display lists
    By nib in forum OpenGL: Advanced Coding
    Replies: 11
    Last Post: 11-04-2006, 07:22 PM
  2. Display Lists
    By 1000_Monkeys_Typing in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-29-2002, 02:59 PM
  3. display lists inside display lists...
    By architekt in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-22-2002, 08:55 PM
  4. # of display lists
    By Osku in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-29-2001, 02:23 AM
  5. display lists
    By Siwko in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 06-01-2000, 04:39 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