I’m building a flight simulator for college and I have a runway plain y+1.0 up from the ground. When I take-off and look at the runway its flickering. I have made a call to the function glEnable(GL_DEPTH_TEST);. But this doesn’t help. If I plane the runway y + 10.0 up from the ground then the flickering stops.
Any ideas or suggestions?
Thanks in advance
Sounds like you have some “ground” or something at the same depth as the “runway”, if that is that case then it will “flicker” because some times the “ground” gets visible, sometimes the “runway” get visible, you would have to increase the Y position or whever is up a little for the actual runway polygons.
Not sure if that’s the problem though.
glPolygonOffset can be good for this purpose.
are you sure you’re using the depth buffer? if so, did you request a 24 bit depth buffer? also, how are you setting up your perspective projection? if you’re using gluPerspective(), make sure you’re not specifying 0 as the distance to the near clipping plane, or a number really close to 0.
if none of those things are the problem, then it’s probably just a z fighting issue. to help with that, you can a) request a larger depth buffer (24 bits is the max on most cards), b) push out the near clipping plane, or pull in the far clipping plane, c) manually add an offset to the polygon location (as you’re currently doing), or d) use glPolygonOffset() to automatically offset the polygon location for you.