Please Help: Objects Rendering in Reverse Depth Order

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.

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.

Good question. I’ll add some debugging code to identify actual depth bits after the context is created.

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!

glDepthRange and glDepthFunc, either could implement your desired effect.

Of course! Thank you for the reminder. I appreciate the help.