Sign in to follow this  

Display Lists and Not Display Lists

This topic is 3811 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

Hi, I have some code:
glLoadIdentity()
glTranslatef(-0.129, 0.197, -0.5)
glCallList(4)
glTranslatef(-0.127, 0.0, 0.0)
glColor4f(1.0, 1.0, 1.0, 0.5)
size = 0.008
if timeleft > 19.5:
    timeleft = 19.5
glBegin(GL_QUADS)
glVertex3f(0.0*size, -1.0*size, 0)
glVertex3f(timeleft*size, -1.0*size, 0)
glVertex3f(timeleft*size, 1.0*size, 0)
glVertex3f(0.0*size, 1.0*size, 0)
glEnd()
glColor4f(1.0, 1.0, 1.0, 1.0)
but if I comment out glCallList(4), the quad is not drawn! Why not? Here's the code for display list 4:
size = .01
glGenLists(1)
glNewList(4, GL_COMPILE)
glBindTexture(GL_TEXTURE_2D, textures[0])
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, selfSurface.get_width(), selfSurface.get_height(), 0,
              GL_RGBA, GL_UNSIGNED_BYTE, selfData )
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glBegin(GL_QUADS)
glTexCoord2f(0.0, 0.0); glVertex3f(-12.9636*size, -1.0*size, 0.0)
glTexCoord2f(1.0, 0.0); glVertex3f(12.9636*size, -1.0*size, 0.0)
glTexCoord2f(1.0, 1.0); glVertex3f(12.9636*size, 1.0*size, 0.0)
glTexCoord2f(0.0, 1.0); glVertex3f(-12.9636*size, 1.0*size, 0.0)
glEnd();
glEndList()

Share this post


Link to post
Share on other sites
Do you mean the latter quad, since commenting out glCallList(4) will of course disable the rendering of the quad you've compiled to the drawlist 4?

If you mean the latter quad, it seems to have no texture coordinates, so you should disable the GL_TEXTURE_2D (I assume you have it enabled since your call list quad has texture coordinates) before rendering it.
When you render the call list quad, the texture coordinate for every vertex of the secondary quad is same which was the last texture coordinate for the call list quad, and if the texturing is enabled the whole quad will be textured with one texel and it becomes visible. If you disable the call list quad, and draw the secondary quad, every texture coordinate will be most likely 0,0 if you haven't set any texture coordinates previously.

Share this post


Link to post
Share on other sites
In creating your list, you are also uploading the date for the texture. You should not be doing this, it will cause speed problems later, and may or may not be causing your current problem.

I think that's your problem. The texture isn't being uploaded (all the calls in the compiling of the display list arent' actually called until you call glCallList, so the texture is never uploaded when you comment out the list call).

Hope that helps
~Zix

[Edited by - zix99 on July 10, 2007 4:40:33 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Geometrian
The problem was already solved, but yes, I know what you are talking about. strangely enough, the other way makes it run slower!

Looks like this depends upon your GL implementation and what you're doing in the display list. On my system, using display lists incurs a slight but constant penalty. Using them for setting up textures is quite a bit slower than just using texture names, but using them for setting up other kinds of state (e.g. matrices, shaders, lighting) is a little bit faster than setting that state up manually, although of course it's faster if you can avoid setting the state at all.

Share this post


Link to post
Share on other sites

This topic is 3811 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this