PDA

View Full Version : depth buffer



Gandalf the Grey
03-27-2004, 05:01 PM
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.

chowe6685
03-27-2004, 05:28 PM
are you requesting a depth buffer when you create the window?

Gandalf the Grey
03-28-2004, 12:13 AM
That's exactly what I needed, now I can move on.

Thanks.

Yin1
03-28-2004, 04:04 AM
We need to know how you get OpenGL rendering context. If you use the libSDL the OpenGL tutorials on www.libSDL.org. (http://www.libSDL.org.) Else try to find an another page about OpenGL, download an tutorial and read it line-by-line.