We are experiencing some artifacts during zooming (see picture). We perform zoom scaling the first 4 parameters of the glOrtho(left, right, bottom, top, near, far) method and noticed that changing the zNear and zFar values something changes. Currently we use the -1e6 for near and +1e6 for far: are the wrong? We also tested some other combination like -1e5 and +1e5 without success.
znear /zfar values should define the smallest range in which fits what you want to see. Otherwise you loose zbuffer precision, which alter depth tests precision, and it results in this type of artifacts.
That’s because glOrtho has a linear Z-conversion between eye-space and screen space Z-coordinate while the perspective camera has a non-linear conversion between eye-space and screen space Z-coordinate. For the non-linear conversion, the depth resolution is dependent on the distance of the object to the camera. If it’s near, you get good Z-resolution.