1GLUPERSPECTIVE(3G) OpenGL Manual GLUPERSPECTIVE(3G)
2
3
4
6 gluPerspective - set up a perspective projection matrix
7
9 void gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear,
10 GLdouble zFar);
11
13 fovy
14 Specifies the field of view angle, in degrees, in the y direction.
15
16 aspect
17 Specifies the aspect ratio that determines the field of view in the
18 x direction. The aspect ratio is the ratio of x (width) to y
19 (height).
20
21 zNear
22 Specifies the distance from the viewer to the near clipping plane
23 (always positive).
24
25 zFar
26 Specifies the distance from the viewer to the far clipping plane
27 (always positive).
28
30 gluPerspective specifies a viewing frustum into the world coordinate
31 system. In general, the aspect ratio in gluPerspective should match the
32 aspect ratio of the associated viewport. For example, aspect = 2.0
33 means the viewer's angle of view is twice as wide in x as it is in y.
34 If the viewport is twice as wide as it is tall, it displays the image
35 without distortion.
36
37 The matrix generated by gluPerspective is multipled by the current
38 matrix, just as if glMultMatrix() were called with the generated
39 matrix. To load the perspective matrix onto the current matrix stack
40 instead, precede the call to gluPerspective with a call to
41 glLoadIdentity().
42
43 Given f defined as follows:
44
45 f = cotangent fovy 2 The generated matrix is
46
47 f aspect 0 0 0 0 f 0 0 0 0 zFar + zNear zNear - zFar 2 × zFar × zNear
48 zNear - zFar 0 0 -1 0
49
51 Depth buffer precision is affected by the values specified for zNear
52 and zFar. The greater the ratio of zFar to zNear is, the less effective
53 the depth buffer will be at distinguishing between surfaces that are
54 near each other. If
55
56 r = zFar zNear
57
58 roughly log 2 r bits of depth buffer precision are lost. Because r
59 approaches infinity as zNear approaches 0, zNear must never be set to
60 0.
61
63 gluOrtho2D(), glFrustum(), glLoadIdentity(), glMultMatrix()
64
66 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
67 under the SGI Free Software B License. For details, see
68 http://oss.sgi.com/projects/FreeB/.
69
71 opengl.org
72
73
74
75opengl.org 07/13/2018 GLUPERSPECTIVE(3G)