GL_DEPTH_TEST -> What am I doing wrong?

Just learning OpenGL, so I’m playing with simple programs to get the hang of things. I’m experimenting with 3d and I swear the following code should result with the red square under the blue square, but when I run it, the red’s always above (because it is drawn later) even though it should be hidden by the depth testing. What’s the problem?
Relevant code (in its entirety, no camera tricks or anything)
glClearColor(0.0, 0.0, 0.0, 1.0);
glOrtho(-3.0, 3.0, -3.0, 3.0, -20.0, 20.0);


    	/* FRONT , blue */
            glColor3f(0.0, 0.0, 1.0);
            glVertex3f(1.0, -1.0, -1.0);
            glVertex3f(1.0, 1.0, -1.0);
            glVertex3f(-1.0, 1.0, -1.0);
            glVertex3f(-1.0, -1.0, -1.0);
            /* BACK , red */
	glColor3f(1.0, 0.0, 0.0);
            glVertex3f(1.25, -1.25, -1.25);
            glVertex3f(1.25, 0.75, -1.25);
            glVertex3f(-0.75, 0.75, -1.25);
            glVertex3f(-0.75, -1.25, -1.25);

why do you put the near plane behind the eye? Try something like:

glOrtho(-3.0, 3.0, -3.0, 3.0, 1.0, 20.0);

Even if I bring the planes in very tight

glOrtho(-3.0, 3.0, -3.0, 3.0, 0.9, 1.26);

red is still on top.

Check the pixel format if you have a depth buffer at all.

You were right on target. The fault, Bob, lay not in my GL, but in my GDK. When I made the window, I didn’t bother to ask for a depth buffer.

There are times when I’ve felt like a bigger idiot, but not many…