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.