The code is original, except I've removed the gluPerspective line, made it non-fullscreen and changed the drawGLScene() routine.
Here is the new drawGLScene() :
int drawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0, 0.0f, -0.5f);
glColor3f(1, 1, 1);
glBegin(GL_QUADS);
glVertex3f(-0.5f, 0.5f, 0.2f);
glVertex3f(0.5f, 0.5f, 0.2f);
glVertex3f(0.5f, -0.5f, 0.2f);
glVertex3f(-0.5f, -0.5f, 0.2f);
glEnd();
glColor3f(1, 0, 0);
glBegin(GL_QUADS);
glVertex3f(-0.5f, 0.5f, -0.2f);
glVertex3f(0.5f, 0.5f, -0.2f);
glVertex3f(0.5f, -0.5f, -0.2f);
glVertex3f(-0.5f, -0.5f, -0.2f);
glEnd();
if (GLWin.doubleBuffered)
{
glXSwapBuffers(GLWin.dpy, GLWin.win);
}
return True;
}
As you can see, I'm drawing 2 rectangles at the same position, except along the z-axis.
The first is colored white, and has its vectices for z at 0.2f. The second is red, and z is at -0.2f.
For some reason, the red quad appears in front of the white one. Seeing how opengl treats the negative z axis as going into the screen, I'm trying to understand why the white quad (z at 0.2f) isn't drawn in front of the red one.