gluPerspective(3) gluPerspective(3)

## NAME

gluPerspective- set up a perspective projection matrix

## C SPECIFICATION

voidgluPerspective( GLdoublefovy, GLdoubleaspect, GLdoublezNear, GLdoublezFar)

## PARAMETERS

fovySpecifies the field of view angle, in degrees, in theydirec- tion.aspectSpecifies the aspect ratio that determines the field of view in thexdirection. The aspect ratio is the ratio ofx(width) toy(height).zNearSpecifies the distance from the viewer to the near clipping plane (always positive).zFarSpecifies the distance from the viewer to the far clipping plane (always positive).

## DESCRIPTION

gluPerspectivespecifies a viewing frustum into the world coordinate system. In general, the aspect ratio ingluPerspectiveshould match the aspect ratio of the associated viewport. For example, aspect = 2.0 means the viewer's angle of view is twice as wide inxas it is iny. If the viewport is twice as wide as it is tall, it displays the image without distortion. The matrix generated bygluPerspectiveis multipled by the current matrix, just as ifglMultMatrixwere called with the generated matrix. To load the perspective matrix onto the current matrix stack instead, precede the call togluPerspectivewith a call toglLoadIdentity. Givenfdefined as follows: f = cotangent(fovy/2) The generated matrix is f ------------ 0 0 0 aspect 0 f 0 0 zFar+zNear 2*zFar*zNear 0 0 ---------- ------------ zNear-zFar zNear-zFar 0 0 -1 0

## NOTES

Depth buffer precision is affected by the values specified forzNearandzFar. The greater the ratio ofzFartozNearis, the less effec- tive the depth buffer will be at distinguishing between surfaces that are near each other. If r = zFar/zNear roughly log2(r) bits of depth buffer precision are lost. Because r approaches infinity aszNearapproaches 0,zNearmust never be set to 0.

## SEE ALSO

glFrustum(3),glLoadIdentity(3),glMultMatrix(3),gluOrtho2D(3)gluPerspective(3)

Mac OS X 10.6 - Generated Thu Sep 17 20:20:35 CDT 2009