Im having a problem with openGL not recognising that an object is behind another.
To put things into context - i am drawing a terrain and at the moment im adding some water. For the water i’m simply drawing a level quad across the terrain with some blue alpha… Good in theory but when i zoom out on the terrain the quad appears on parts of the terrain where is should be beneath it and sometimes the entire quad is shown.
Is there an easy way to fix this (ie - by changing a flag?) or am I going to have to place my water down with much more accuracy so it doesn’t go beneath the landscape (if you get what i mean)…
Push out the near clip plane, this will help to improve depth buffer accuracy. You could also pull the far plane in a bit, but moving out the near plane will give a better improvment
Simple answer is to keep your near/far clip planes as tight as possible. Maybe you can change the position of your near clip plane depending on your camera position? So if you are closer to the action, your clip plane is nearer the camera. I suppose I mean you could adjust the near clip plane so it just catches the “nearest” object.
If you change the near/far values you’ll soon be able to see if it improves, so it should be easy to test the z fighting theory.