Archived

This topic is now archived and is closed to further replies.

Display List problems

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

I did as NeHe said to in lesson #12 for display lists. However my program doesn''t seem to be working. It doesn''t disply when I call the list. Here is my code to create my list...please tell me what I am doing wrong. glNewList(BackGround, GL_COMPILE); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0, 128, 0, 128, -1, 1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glBegin(GL_TRIANGLES); glTexCoord2f(1.0, 1.0); glVertex2i(128, 0); glTexCoord2f(0.0, 0.0); glVertex2i(0, 128); glTexCoord2f(1.0, 0.0); glVertex2i(128, 128); glTexCoord2f(0.0, 0.0); glVertex2i(0, 128); glTexCoord2f(1.0, 1.0); glVertex2i(128, 0); glTexCoord2f(1.0, 0.0); glVertex2i(0, 0); glEnd(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glEndList(); and here is how I call it: glBindTexture(GL_TEXTURE_2D, texture[0]); glCallList(BackGround); glFlush();

Share this post


Link to post
Share on other sites
Change BackGround to a number for example 1 then it should work:
glNewList(1, GL_COMPILE);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, 128, 0, 128, -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glBegin(GL_TRIANGLES);
glTexCoord2f(1.0, 1.0); glVertex2i(128, 0);
glTexCoord2f(0.0, 0.0); glVertex2i(0, 128);
glTexCoord2f(1.0, 0.0); glVertex2i(128, 128);

glTexCoord2f(0.0, 0.0); glVertex2i(0, 128);
glTexCoord2f(1.0, 1.0); glVertex2i(128, 0);
glTexCoord2f(1.0, 0.0); glVertex2i(0, 0);
glEnd();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glEndList();

and here is how I call it:

glBindTexture(GL_TEXTURE_2D, texture[0]);
glCallList(1);
glFlush();

Share this post


Link to post
Share on other sites