# OpenGL display list troubles

This topic is 4900 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Display lists are so damn simple, I hate having to ask about this but I just can't see what's wrong. Here is a summary of the parts of my program dealing with the lists:
//global
GLuint partList;

/*main*/
partList = glGenLists(1);
load(); //function that reads in the object data and loads it into the list

//read in object data (I know this works properly)
glPushMatrix();
glNewList(partList, GL_COMPILE);
for(int i = 0; i < numTriangles; i++)
{
glNormal3f(/*normal vector*/);
glBegin(GL_TRIANGLES);
//vertex 1
//vertex 2
//vertex 3
glEnd();
glEndList();
glPopMatrix();

/*renderScene()*/
//other drawing stuff
drawPart();

/*drawPart()*/
glPushMatrix();
//translation to get part into place (properly alligned part prior to display list implementation)
//set material properties
glCallList(partList);
glPopMatirx();

//when program exists, delete lists


That's all there is. Everything was orienting and drawing correctly before I added the display list code. I just moved the drawing to the load function and added the glNewList()/glEnd and added a glCallList() where the drawing stuff was. Should work, no? It looks good to me, it's comparable to the way I've done display lists in the past, matches up to my openGL book and nehe, but the part just doesn't draw. <insert oversight observations here> [Edited by - CyberSlag5k on February 15, 2005 12:05:09 PM]

##### Share on other sites
Here's something odd. I ran the debugger and noticed that partList (my display id) has a value of 0, which is invalid. So I called glIsList and it returned GL_FALSE. Why would is this an invalid range? All I do is declare GLuint partList globally and then set it equal to what glGenLists(1) returns in main. At that point, the only other thing Ido at that point is declare a few other variables and open 2 files for reading input.

Any suggestions?

##### Share on other sites
I don't see any init code there so I gotta ask, you are creating a valid gl context first, right? Other than that I can't see what else could be wrong. Maybe post some more code?

##### Share on other sites
Ah, that's it. I had it above the callback functions. I didn't think about that. Thank you.

##### Share on other sites
Hmm...it displays properly now, but I'm not really seeing a performance increase, as I thought I would. The object that I'm drawing is something around 65,000 triangles, so I thought putting it into a display list would speed things up quite a bit. It doesn't look bad, but the motion isn't that smooth. Could it just be that drawing the 65,000 triangles isn't the problem, but translating 65,000 is?

EDIT: Is this where vertex arrays come in handY? I've never used them, but in this case I'd imagine they'd be more efficient as I have everything stored in one giant array anyway.

1. 1
2. 2
Rutin
22
3. 3
JoeJ
18
4. 4
5. 5

• 17
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631726
• Total Posts
3001910
×