1GLUPERSPECTIVE(3G)                                          GLUPERSPECTIVE(3G)
2
3
4

NAME

6       gluPerspective - set up a perspective projection matrix
7
8

C SPECIFICATION

10       void gluPerspective( GLdouble fovy,
11                            GLdouble aspect,
12                            GLdouble zNear,
13                            GLdouble zFar )
14
15       delim $$
16

PARAMETERS

18       fovy    Specifies  the field of view angle, in degrees, in the y direc‐
19               tion.
20
21       aspect  Specifies the aspect ratio that determines the field of view in
22               the x direction.  The aspect ratio is the ratio of x (width) to
23               y (height).
24
25       zNear   Specifies the distance from the viewer  to  the  near  clipping
26               plane (always positive).
27
28       zFar    Specifies  the  distance  from  the  viewer to the far clipping
29               plane (always positive).
30

DESCRIPTION

32       gluPerspective specifies a viewing frustum into  the  world  coordinate
33       system.   In  general,  the aspect ratio in gluPerspective should match
34       the aspect ratio of the associated viewport. For  example,  $  "aspect"
35       ~=~  2.0 $ means the viewer's angle of view is twice as wide in x as it
36       is in y.  If the viewport is twice as wide as it is tall,  it  displays
37       the image without distortion.
38
39       The  matrix  generated  by  gluPerspective is multiplied by the current
40       matrix, just as if glMultMatrix were called with the generated  matrix.
41       To  load  the perspective matrix onto the current matrix stack instead,
42       precede the call to gluPerspective with a call to glLoadIdentity.
43
44       Given f defined as follows:
45
46                        f  ~=~ cotangent"("{"fovy" over 2}")"
47       The generated matrix is
48
49                            left ( ~~ down 130 { matrix {
50          ccol { {f over "aspect"} above 0 above 0 above 0 }
51          ccol { 0 above f above 0 above 0 }
52          ccol { 0 above 0 above {{"zFar" + "zNear"} over {"zNear" -  "zFar"}}
53       above -1 }
54          ccol  {  0  above  0  above  {{2 * "zFar" * "zNear"} over {"zNear" -
55       "zFar"}} above 0} }}  ~~~ right )
56
57

NOTES

59       Depth buffer precision is affected by the values  specified  for  zNear
60       and  zFar.   The greater the ratio of zFar to zNear is, the less effec‐
61       tive the depth buffer will be at distinguishing between  surfaces  that
62       are near each other.  If
63
64                             $r ~=~ "zFar" over "zNear"$
65
66
67       roughly $log sub 2 r$ bits of depth buffer precision are lost.  Because
68       $r$ approaches infinity as zNear approaches 0, zNear must never be  set
69       to 0.
70

SEE ALSO

72       glFrustum(3G), glLoadIdentity(3G), glMultMatrix(3G), gluOrtho2D(3G)
73
74
75
76                                                            GLUPERSPECTIVE(3G)
Impressum