Jump to content
  • Advertisement

Archived

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

Running_Wolf

Display List problems

This topic is 6223 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
Advertisement
Add this to the beginning of your code:

BackGround = glGenLists(1);

Jason A.

---
I write code.
DelphiGL (http://delphigl.cfxweb.net)

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

  • 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!