# FreeBSD Manual Pages

GLUPERSPECTIVE() GLUPERSPECTIVE()NAMEgluPerspective- set up a perspective projection matrixC SPECIFICATIONvoidgluPerspective( GLdoublefovy, GLdoubleaspect, GLdoublezNear, GLdoublezFar) delim $$PARAMETERSfovySpecifies 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).DESCRIPTIONgluPerspectivespecifies 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 ma- trix, 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" 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 )NOTESDepth 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" over "zNear"$ roughly $log sub 2 r$ bits of depth buffer precision are lost. Because $r$ approaches infinity aszNearapproaches 0,zNearmust never be set to 0.SEE ALSOglFrustum,glLoadIdentity,glMultMatrix,gluOrtho2DGLUPERSPECTIVE()

NAME | C SPECIFICATION | PARAMETERS | DESCRIPTION | NOTES | SEE ALSO

Want to link to this manual page? Use this URL:

<https://www.freebsd.org/cgi/man.cgi?query=gluPerspective&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>