I am trying to create a static background. I have written some code to do this but I have encountered a problem. Anything I draw after the background doesn’t show up. I know that it’s viewable on the screen because when I disable the background it shows up. Here is my code:
// The loading of the background. From NeHe’s site.
LoadBackGroundTexture(Filename, *texture);
// The displaying of the background.
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0, 128, 0, 128);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glBindTexture(GL_TEXTURE_2D, texture[0]);
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();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glLoadIdentity();
What am I doing wrong?