PDA

View Full Version : Please Help: Objects Rendering in Reverse Depth Order



robosport
02-02-2006, 01:11 PM
First let me say this isn't the newbie OpenGL question the title of the post makes it sound like.

I have a home grown OpenGL 3D engine. It works on every graphics card we test from GeForce4 and later and Radeons, etc.

One user of this engine is reporting a problem. The rendering looks great but every object is rendered in the reverse depth order. The objects (mesh collection of faces) render individually just fine but objects that should be in back are in front. Its almost like the depth buffer is inverted.

I've confirmed counter-clockwise winding on everything and I've confirmed GL_DEPTH_TEST and related depth test properties are correctly set, and as I said only one system (out of hundreds of systems) is having this problem. Specifically it is an NVIDIA GeForce FX Go5100.

Any clues what could be causing it? Driver settings? etc. Any ideas are much appreciated.

Thank you.

dorbie
02-02-2006, 01:54 PM
Is the depth buffer inverted or just disabled?

It may be that there is no depth buffer on the visual you got from your pixel format descriptor request. That would be the most likely explanation.

robosport
02-02-2006, 10:04 PM
Good question. I'll add some debugging code to identify actual depth bits after the context is created.

robosport
02-03-2006, 02:37 PM
I confirmed that the OpenGL display buffer being created has all requested bits including 24 combined for RGB, 8 for stencil, and 24 bits for depth - created using the OpenGL extended pixel format extension.

Any other ideas? Is there a way to programmatically invert the depth buffer?

Thanks!

dorbie
02-03-2006, 10:09 PM
glDepthRange and glDepthFunc, either could implement your desired effect.

robosport
02-04-2006, 11:35 AM
Of course! Thank you for the reminder. I appreciate the help.