GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


Manpage of GLUPERSPECTIVE

GLUPERSPECTIVE

Index
 

NAME

gluPerspective - set up a perspective projection matrix

 

C SPECIFICATION

void f3gluPerspectivefP( GLdouble fIfovyfP,
f2fovyfP
Specifies the field of view angle, in degrees, in the f2yfP direction.
f2aspectfP
Specifies the aspect ratio that determines the field of view in the f2xfP direction. The aspect ratio is the ratio of f2xfP (width) to f2yfP (height).
f2zNearfP
Specifies the distance from the viewer to the near clipping plane (always positive).
f2zFarfP
Specifies the distance from the viewer to the far clipping plane (always positive).
 

DESCRIPTION

%f3gluPerspectivefP specifies a viewing frustum into the world coordinate system. In general, the aspect ratio in %f3gluPerspectivefP should match the aspect ratio of the associated viewport. For example, $ "aspect" ~=~ 2.0 $ means the viewer's angle of view is twice as wide in f2xfP as it is in f2yfP. If the viewport is twice as wide as it is tall, it displays the image without distortion. The matrix generated by %f3gluPerspectivefP is multipled by the current matrix, just as if f3glMultMatrixfP were called with the generated matrix. To load the perspective matrix onto the current matrix stack instead, precede the call to %f3gluPerspectivefP with a call to f3glLoadIdentityfP. Given f2ffP defined as follows:


f ~=~ cotangent"("{"fovy" over 2}")" The generated matrix is


left ( ~~ down 130 { matrix {
   ccol { {f over "aspect"} above 0 above 0 above 0 }
   ccol { 0 above f above 0 above 0 }
   ccol { 0 above 0 above {{"zFar" + "zNear"} over {"zNear" - "zFar"}} above -1 }
   ccol { 0 above 0 above {{2 * "zFar" * "zNear"} over {"zNear" - "zFar"}} above 0} }} ~~~ right )

 

NOTES

Depth buffer precision is affected by the values specified for f2zNearfP and f2zFarfP. The greater the ratio of f2zFarfP to f2zNearfP is, the less effective the depth buffer will be at distinguishing between surfaces that are near each other. If

$r ~=~ "zFar" over "zNear"$

roughly $log sub 2 r$ bits of depth buffer precision are lost. Because $r$ approaches infinity as f2zNearfP approaches 0, f2zNearfP must never be set to 0.  

SEE ALSO

f3glFrustum(3G)fP, f3glLoadIdentity(3G)fP, f3glMultMatrix(3G)fP, %f3gluOrtho2D(3G)fP


 

Index

NAME
C SPECIFICATION
DESCRIPTION
NOTES
SEE ALSO