<HTML> <BODY> <PRE> <STRONG>NAME</STRONG> <STRONG>gluPerspective</STRONG> - set up a perspective projection matrix <STRONG>C</STRONG> <STRONG>SPECIFICATION</STRONG> void <STRONG>gluPerspective</STRONG>( GLdouble <EM>fovy</EM>, GLdouble <EM>aspect</EM>, GLdouble <EM>zNear</EM>, GLdouble <EM>zFar</EM> ) <STRONG>PARAMETERS</STRONG> <EM>fovy</EM> Specifies the field of view angle, in degrees, in the <EM>y</EM> direction. <EM>aspect</EM> Specifies the aspect ratio that determines the field of view in the <EM>x</EM> direction. The aspect ratio is the ratio of <EM>x</EM> (width) to <EM>y</EM> (height). <EM>zNear</EM> Specifies the distance from the viewer to the near clipping plane (always positive). <EM>zFar</EM> Specifies the distance from the viewer to the far clipping plane (always positive). <STRONG>DESCRIPTION</STRONG> <STRONG>gluPerspective</STRONG> specifies a viewing frustum into the world coordinate system. In general, the aspect ratio in <STRONG>gluPerspective</STRONG> 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 <EM>x</EM> as it is in <EM>y</EM>. If the viewport is twice as wide as it is tall, it displays the image without distortion. The matrix generated by <STRONG>gluPerspective</STRONG> is multipled by the current matrix, just as if <STRONG>glMultMatrix</STRONG> were called with the generated matrix. To load the perspective matrix onto the current matrix stack instead, precede the call to <STRONG>gluPerspective</STRONG> with a call to <STRONG>glLoadIdentity</STRONG>. Given <EM>f</EM> defined as follows: f = cotangent(<STRONG>____</STRONG>) 2 The generated matrix is ( ) | ___<STRONG>_</STRONG>__ | | aspect 0 0 0 | | | | 0 f 0 0 | | <STRONG>__________</STRONG> <STRONG>____________</STRONG> | | 0 0 zNear-zFar zNear-zFar | ( ) 0 0 -1 0 <STRONG>NOTES</STRONG> Depth buffer precision is affected by the values specified for <EM>zNear</EM> and <EM>zFar</EM>. The greater the ratio of <EM>zFar</EM> to <EM>zNear</EM> is, the less effective the depth buffer will be at distinguishing between surfaces that are near each other. If r = _<STRONG>____</STRONG> zNear roughly log r bits of depth buffer precision are lost. Because r a<STRONG>p</STRONG>proaches infinity as <EM>zNear</EM> approaches 0, <EM>zNear</EM> must never be set to 0. <STRONG>SEE</STRONG> <STRONG>ALSO</STRONG> <STRONG>glFrustum</STRONG>, <STRONG>glLoadIdentity</STRONG>, <STRONG>glMultMatrix</STRONG>, <STRONG>gluOrtho2D</STRONG> </PRE> </BODY> </HTML>