glortho and depth buffer
I am using opengl on Windows XP. The program is developed in Compaq Visul Fortran version 6.6. In my application I switch beteen perspective and orthografic projection with the following code:
if (projmode .eq. ID_PROJ_MODE_PERSP) then
In the perspective view the depth calculation works fine and round surfaces looks smooth (see figure 1), but in the orthografic view the depth calculation seems wrong (see figure 2). Is there extra calls or parameters to set in order to get the orthografic projection to work?
Figure 1: Perspective view
Figure 2: Orthografic view
Re: glortho and depth buffer
I have solved the problem my self.
The structure in the example is 10 by 10 by 10 and are seen in distance 100. In my program znear = 1 and zfar = 10^20 and this works fine for perspective views, but in orthografic views the very large zfar destroys the precision in the depth calculation. If zfar is changed to 200, all works fine.