depth buffer

The depth buffer is not working for me. From the documentation, I read that to use the depth buffer, you need to do the following:

glEnable(GL_DEPTH_TEST);
glClearBuffer(GL_DEPTH_BUFFER_BIT); // per scene
glClearDepth(<some large value>);

Then render the scene, using glBegin/glEnd and
glFlush or glFinish functions.

My scene renders fine except the depth
buffer doesn’t seem to have any affect.

To test this, I set the depth test function as
follows:
glDepthFunc(GL_NEVER);

But the scene still rendered. I thought the
pipeline was supposed to remove vertices, or
fragments, that do not pass the depth test,
and GL_NEVER should imply that the test is
never passed.

I have read the OpenGL “red” book and the specification, and I cannot seem to figure
out how to get this working.

Any help would be appreciated, thanks.

are you requesting a depth buffer when you create the window?

That’s exactly what I needed, now I can move on.

Thanks.

We need to know how you get OpenGL rendering context. If you use the libSDL the OpenGL tutorials on www.libSDL.org. Else try to find an another page about OpenGL, download an tutorial and read it line-by-line.