I`ve written a program to plot surfaces. Users can rotate the surface using the mouse. When my surface is facing front there´s no problem; but when the surface is rotated, the depth test hides what now is supposed to be near and shows what would have to be behind.
Anybody knows why could this be happenig and how can I fix it? Thanks in advance.
Either you forgot to glEnable(GL_DEPTH_TEST) and the front face view just rendered back to front, then the other view direction will look like what you described, or your viewing frustum’s zNear and zFar span a range too big for the depth bits resolution. In the latter case push zNear out and draw zFar in as much as you can without clipping your drawing. This is always a good idea.
It’s not the cull face either. Sorry for being so tiresome, but i’m getting mad. I’ve been searching what can be wrong but i don’t find it. I thought it could be a missing depth test activation, because there’s another problem: if i draw first the axis, the surface always hides the axis, and if i draw first the surface, the axis is always drawn over the surface and never hidden.
But I’m sure the depth test is enabled (and the cull face disabled) and I don´t know what is wrong.
Thank you for your help.
Thank you very much. I fixed it. I’m working with a Mac OS X languaje called Cocoa and the pixel format creation is a bit different from windows. I was creating it wrong and so I didn’t have the depth buffer. Thank you everybody.