
glEnable(GL_DEPTH_TEST) issues
Posted Thursday, 29 July, 2010 - 01:16 by erkisnotgod inI tried to refrain from posting this here, but the opengl forum site refuses to let me post eventhough I'm a registered user.
Hopefully, someone can help answere this.
I am following some OpenGl tutorials, and have stumbled across an issue where glEnable(GL_DEPTH_TEST) causes the black screen of death.
The problem existy ONLY on Windows 7 (64bit installed). I can take the exact same code, run it on xp and everything is perfect.
Removing the glEnable(GL_DEPTH_TEST) will allow the objects to draw.
I have also tried tweaking the gluLookAt, gluPerspective and glViewport paremeters and always end up with a black window until glEnable(GL_DEPTH_TEST) is removed.
I have created many other projects and have not had an issue running under either OS.
Any suggestions on what the actual issue may be?


Comments
Re: glEnable(GL_DEPTH_TEST) issues
Make sure your Win7 installation is using a proper OpenGL ICD rather than Microsoft's OpenGL emulation (check glGetString(GL_VENDOR)).
You might be hitting some form of undefined behavior (e.g. caused by forgetting to initialize something) that happens to work on some hardware/OS but fail on another. Without seeing some code (setup and rendering) it's impossible to guess the cause.
Re: glEnable(GL_DEPTH_TEST) issues
I will check the calls when I return to the computer with the issue, but this is the code from the tutorial which isn't anything really fancy.
Re: glEnable(GL_DEPTH_TEST) issues
Ok, so I ran the GL_VERSION and GL_VENDOR
XP = V2.1. Nvidia
Win7 = V3.0, Nvidia
SO, I'm kind of leaning towards a driver problem, is this a valid assumption?
Re: glEnable(GL_DEPTH_TEST) issues
just to mention:
glClear(GL_COLOR_BUFFER_BIT); // you need to add GL_DEPTH_BUFFER_BIT flag hereRe: glEnable(GL_DEPTH_TEST) issues
Yup, that was it.
Still doesn't explain why that project ran on WinXP, but not Win7.
Thx for finding my oversight!
Re: glEnable(GL_DEPTH_TEST) issues
Most likely the "default" values found in the depth buffer are different (there could be anything so the nondeterministic behaviour is correct).