PDA

View Full Version : Display Lists aren't displaid



gahre
09-23-2001, 05:53 AM
Sounds funny, but I can't display my display Lists. I call:
#define BODY 1
glNewList(BODY,GL_COMPILE);
glBegin (GL_TRIANGLES);
...;
glEnd();
glEndList();

Everything OK, I think.
Then I want to call the list:

glPushMatrix();
glTranslatef(...);
glRotatef(...);
glCallList(BODY);
glPopMatrix();

What the f*** is wrong? Could it be that I pushed a matrix and didn't Pop it again? Wouldn't that result in a weird output? (Or some elements aren't translated)?
Or is there something that I could have glEnabled / glDisabled???

Thanx in advance,

Thomas Gahr

sb
09-23-2001, 06:08 AM
it should be:
BODY=glGenLists(1)
glNewList(BODY,GL_COMPILE);
glBegin (GL_TRIANGLES);
...;
glEnd();
glEndList();

gahre
09-23-2001, 06:47 AM
Doesn't work. Look:
PLAYERLIST=glGenLists(1);
glNewList(PLAYERLIST,GL_COMPILE);
glBegin(GL_TRIANGLES);
for (int i=0;i<numtri;i++)
{
glVertex3f(player1.tris[i].vertex[2].x,player1.tris[i].vertex[2].y,player1.tris[i].vertex[2].z);
glVertex3f(player1.tris[i].vertex[1].x,player1.tris[i].vertex[1].y,player1.tris[i].vertex[1].z);
glVertex3f(player1.tris[i].vertex[0].x,player1.tris[i].vertex[0].y,player1.tris[i].vertex[0].z);
}
glEnd();
glEndList();

My code to generate the List. Now call it:
glCallList(PLAYERLIST); - What else???

What's wrong? Are the calls to opengl in the list not recorded?

stefan
09-23-2001, 07:20 AM
Hi gahre,

just put the commands you want to compile into the list directly in the code instead of calling glCallList(). I guess it won't display anything neither.
If it works despite what I think, can you tell us what glGenLists(1) returns?

Brent Fogarty
09-23-2001, 11:44 AM
Could it be that your calling your code to create the display list before you have a valid opengl rendering context? or perhaps you are translating the wrong way so that the object isn't infront of the camera any more.

Those are some of the common problems that I can think of.

Bob
09-23-2001, 10:55 PM
You don't have to call glGenLists. glGenLists is just to make sure you use a unique identifier for your displaylists. You can manage this yourself instead, by creating your own identifiers, exactly as gahre did in his first post. Butjust make sure you don't use the same identifier more than once.