i have finished my game for my assignment (which i have to hand in tomorrow at 4pm uk time), but i have ran into an issue with depth testing. i am sure i am using it correctly, (enabling, clearing the buffer, and init with depth test).
basically, it is not drawing objects correctly, and is flashing surface when using the camera etc.
i have tried using LEQUAL etc, which is the closest, but still isnt working properly.
i have read into an issue with gluperspective messing this up if the zNear isnt set above zero, but im not using gluPerspective, im using gluLookat. I have added gluPerspective but it isnt making any difference.
Is there anything else which may mess with depth testing?
but im not using gluPerspective, im using gluLookat.
those are for different purposes, one is to set up the projection matrix the other the ‘viewing part’ of the modelview matrix.
One common reason for incorrect/flickering depth testing is a too small near value or an excessive ratio between far and near (e.g. near = 0.001 far = 100000), the depth buffer does not have enough resolution for such a setup. Increasing near in these cases has a much more pronounced effect than reducing far.
FYR usually, we setup the projection matrix once and the preferred place to keep it is in the resize handler and also set the modelview matrix when we leave it.