I’m having some problems with (maybe) the depth buffer…
I’m using plain OGL with VC++ and Win2k on a g400.
The problem :
It seems like OpenGL draws objects in the order the drawing subroutines are called instead of the Z order they should look.
I’ll explain, if I draw a GL_QUAD near the camera and THEN I draw a GL_QUAD far away it draws the second oone in front of the first.
And if I rotate the whole scene 180^ I get the same effect.
The objects seems to be drawn not using the Z values but using the “time” their drawing routines are called.
All primitives are draw in the exact order as you draw then in your code. This is why you use the z-buffer, to solve the problem when you draw a polygon further away in the second pass. If you don’t want to use the z-buffer, you have to sort the primitives yourself. But then another problem will arise, HOW to sort them (not too hard to do the actual sorting, but to get it correct in all cases is nearly impossible).
One first guess would be that you are using the depthbuffer the wrong way. You haven’t posted some pieces of your code, and the problem might be in there.
But another strange thing I noticed is your call to glLoadIdentity just before drawing each primitive. If you have the modelview matrix enabled, this will reset the modelview matrix, and your 180 degree rotation will be lost.