Results 1 to 4 of 4

Thread: Display-lists (getting slightly mad :-)

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    linz, ooe, austria
    Posts
    3

    Display-lists (getting slightly mad :-)

    Hi,
    i really would be happy, if someone could tell me, what i'm making wrong.
    Everytime i want to work with lists, my screen stays blank, so i reduced my problem for a single triangle i can rotate. It works fine, when i have the code:

    glBegin(GL_TRIANGLES);
    glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,mat_spe cular);
    glMaterialfv(GL_FRONT_AND_BACK,GL_SHININESS,mat_sh ininess);
    glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,mat_ambi ent);
    glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,mat_diff use);
    glColor3f(1.0,1.0,0.0);
    glVertex3f(-5000, -2887, 0);
    glVertex3f(5000, -2887, 0);
    glVertex3f(0, 5800, 0);
    glEnd();

    in my display-function.

    But when i try to create a list for this object in my init-function like:

    LIST_NR_LAND=glGenLists(1);

    glNewList(LIST_NR_LAND,GL_COMPILE);
    glBegin(GL_TRIANGLES);
    glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,mat_spe cular);
    glMaterialfv(GL_FRONT_AND_BACK,GL_SHININESS,mat_sh ininess);
    glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,mat_ambi ent);
    glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,mat_diff use);
    glColor3f(1.0,1.0,0.0);
    glVertex3f(-5000, -2887, 0);
    glVertex3f(5000, -2887, 0);
    glVertex3f(0, 5800, 0);
    glEnd();
    glEndList();

    and change the code in my display-function to:

    glCallList(LIST_NR_LAND);

    nothing happens, i just get a blank-screen.

    (LIST_NR_LAND is a global GLuint variable)

    If anyone has a clue, why this could happen, please respond. I really changed nothing else in my code and it works fine, when i don't use a display-list. (But i want to display a fractal-landscape, when i'm finished, so i really need a list)

    Bye,
    Stefan

  2. #2
    Guest

    Re: Display-lists (getting slightly mad :-)

    do you create the list after creating the context. That is do you init glut or do whatever it is you need to do before creating the list?

    Try this see if the number really is a list

    glIsList(THE_VARIABLE_THAT_IS_A_LIST)

    check to see if it really is a display list

  3. #3
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: Display-lists (getting slightly mad :-)

    youre only allowed to put certain opengl things between begin()..end() statements. i could be wrong but i believe glMaterial is not one of the things allowed. check the red book for further info

  4. #4
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    linz, ooe, austria
    Posts
    3

    Re: Display-lists (getting slightly mad :-)

    Thanks, i've found my mistake now, i was creating the list befor i initialized all the GlutInit... lines.
    Just moving the list-generating-code some lines below solved the problem.

    Thanks,
    Stefan

Similar Threads

  1. Display Lists and VAR
    By azcoder in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-24-2002, 12:58 PM
  2. display lists inside display lists...
    By architekt in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-22-2002, 08:55 PM
  3. Display Lists
    By Robin Forster in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-14-2001, 06:11 PM
  4. Is re-use of display lists like this ok ?
    By pocketmoon in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 05-22-2001, 06:39 AM
  5. # of display lists
    By Osku in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-29-2001, 02:23 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