1GLULOOKAT(3G) OpenGL Manual GLULOOKAT(3G)
2
3
4
6 gluLookAt - define a viewing transformation
7
9 void gluLookAt(GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ,
10 GLdouble centerX, GLdouble centerY, GLdouble centerZ,
11 GLdouble upX, GLdouble upY, GLdouble upZ);
12
14 eyeX, eyeY, eyeZ
15 Specifies the position of the eye point.
16
17 centerX, centerY, centerZ
18 Specifies the position of the reference point.
19
20 upX, upY, upZ
21 Specifies the direction of the up vector.
22
24 gluLookAt creates a viewing matrix derived from an eye point, a
25 reference point indicating the center of the scene, and an UP vector.
26
27 The matrix maps the reference point to the negative z axis and the eye
28 point to the origin. When a typical projection matrix is used, the
29 center of the scene therefore maps to the center of the viewport.
30 Similarly, the direction described by the UP vector projected onto the
31 viewing plane is mapped to the positive y axis so that it points upward
32 in the viewport. The UP vector must not be parallel to the line of
33 sight from the eye point to the reference point.
34
35 Let
36
37 F = centerX - eyeX centerY - eyeY centerZ - eyeZ
38
39 Let UP be the vector upX upY upZ.
40
41 Then normalize as follows: f = F F
42
43 UP ″ = UP UP
44
45 Finally, let s = f × UP ″, and u = s s × f.
46
47 M is then constructed as follows: M = s 0 s 1 s 2 0 u 0 u 1 u
48 2 0 - f 0 - f 1 - f 2 0 0 0 0 1
49
50 and gluLookAt is equivalent to
51
52 glMultMatrixf(M);
53 glTranslated(-eyex, -eyey, -eyez);
54
55
56
58 gluPerspective(), glFrustum()
59
61 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
62 under the SGI Free Software B License. For details, see
63 http://oss.sgi.com/projects/FreeB/.
64
66 opengl.org
67
68
69
70opengl.org 07/13/2018 GLULOOKAT(3G)