Archived

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

Running_Wolf

Display List problems

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