View Full Version : Enable depth test...
05-31-2000, 03:03 AM
I've just added the line glEnable(Gl_DEPTH_TEST) to my program and I get a black screen...
I've read some topics about depth test but I still don't know the different parameters to configure.
Could anyone tell me everything I have to add in my program to make it work ???
05-31-2000, 04:00 AM
You need a depthbuffer, i glut you just pass something like GLUT_DEPTHBUFFER when you initialize your app, in win32 api you set the cDepthBits in the PIXELFORMATDESCRIPTOR structure to something like 16 or 32.
You also need the set up the depthfunction. Try glDepthFunc(GL_LESS), if that doesn't work try glDepthFunc(GL_GREATER).
remeber to clear the depth buffer:
06-02-2000, 12:33 AM
My windows had allready a 32 bit z-buffer in the pixelformatdescriptor.
I clear the depth_buffer_bit at the same time as the color_buffer_bit (glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) )
For the glDepthFunc, I tried GL_LESS and GL_GREATER but I still have a black screen.
Is there anything else I have to do ???
06-02-2000, 11:00 AM
Try setting it to 16. Your card/drivers may not work right with a 32 bit depth buffer.
06-02-2000, 11:39 AM
I have the same problem when I work with MFC. I normally use glut and every works correctly. Then I tried MFC with a PFD with 24bits for color and 32 (also tried 16 24 8)and if I enable glDepthTest I get a light blue(?) window. In addition, glClearColor doesn't work. Colors are displayed correctly for primitives, but not for the background. Where's the problem?
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.