Jump to content
  • Advertisement
Sign in to follow this  
CyberSlag5k

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.

If you intended to correct an error in the post then please contact us.

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

/*load()*/
//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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!