-
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
call fgluPerspective(vAngle,aspect,znear,zfar)
call fglTranslatef(xor,yor,0.0)
else
ytop =-yor+dify
ybtm =-yor-dify
xrght =-xor+difx
xleft =-xor-difx
call fglOrtho(xleft,xrght,ybtm,ytop,znear,zfar)
end if
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules