View Full Version : glEnable(GL_DEPTH_TEST) resulting in black screen :(

04-03-2006, 02:44 PM
can someone please help me? im fairly new to opengl and just followed some codes on the red book about lighting...

i managed to enable lighting and view my scene without enabling depth test (which is part of the init lighting code in the red book) but whenever i enable it i only get a black screen...

someone care to help a noob? :)

04-03-2006, 03:57 PM
do you request a depth buffer ? ie. in GLUT you need to do something like glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
do you clear your depth buffer ?
do you change the glDepthFunc default value ?

04-04-2006, 01:36 AM
oh thanks, i just adjusted the value passed to glDepthFunc() and it works :)