10-01-2003, 06:30 AM
My test app displays a unit cube and allows me to orient it with pitch and yaw controls. In wireframe mode, the viewing and perspective projection are demonstrated to be correct.
Chaos ensues when I enable lighting and the depth test.
Display works correctly only if I enable back-face culling. If I do not cull back faces, then the back faces of the cube get drawn over the top of the front faces. The back facing geometry seems to have its depth calculated incorrectly, so it clobbers front faces that are actually closer to my view point.
I understand why you cull backfaces to improve efficiency, but I didn't think you had to cull them to achieve correctness.
Yes, I understand about GL_CW vs GL_CCW faces. That's not the problem. When I DO cull backfaces, it DOES display the front faces correctly.
Any suggestions?
Chaos ensues when I enable lighting and the depth test.
Display works correctly only if I enable back-face culling. If I do not cull back faces, then the back faces of the cube get drawn over the top of the front faces. The back facing geometry seems to have its depth calculated incorrectly, so it clobbers front faces that are actually closer to my view point.
I understand why you cull backfaces to improve efficiency, but I didn't think you had to cull them to achieve correctness.
Yes, I understand about GL_CW vs GL_CCW faces. That's not the problem. When I DO cull backfaces, it DOES display the front faces correctly.
Any suggestions?