9
.ds Xs 1014 4 lookat.gl
13
\- define a viewing transformation
19
.ta \w'\f3void \fPgluLookAt( 'u
22
GLdouble \fIcenterX\fP,
23
GLdouble \fIcenterY\fP,
24
GLdouble \fIcenterZ\fP,
34
.TP \w'\f2eyeX\fP\ \f2eyeY\fP\ \f2eyeZ\fP\ \ 'u
35
\f2eyeX\fP, \f2eyeY\fP, \f2eyeZ\fP
36
Specifies the position of the eye point.
38
\f2centerX\fP, \f2centerY\fP, \f2centerZ\fP
39
Specifies the position of the reference point.
41
\f2upX\fP, \f2upY\fP, \f2upZ\fP
42
Specifies the direction of the \f2up\fP vector.
44
\%\f3gluLookAt\fP creates a viewing matrix derived from an eye point, a reference
45
point indicating the center of the scene, and an \f2UP\fP vector.
48
maps the reference point to the negative \f2z\fP axis and the
49
eye point to the origin.
50
When a typical projection matrix is used,
51
the center of the scene therefore maps to the center of the viewport.
52
Similarly, the direction described by the \f2UP\fP
53
vector projected onto the viewing plane is mapped to the positive \f2y\fP
54
axis so that it points upward in the viewport.
55
The \f2UP\fP vector must not be parallel to the line of sight from the
56
eye point to the reference point.
61
F ~=~ left ( down 20 { ~ matrix {
62
ccol {"centerX" above "centerY" above "centerZ"}
63
ccol { ~-~ above ~-~ above ~-~}
64
ccol {"eyeX" above "eyeY" above "eyeZ"}
70
Let \f2UP\fP be the vector $("upX", "upY", "upZ")$.
72
Then normalize as follows:
74
f ~=~ F over {|| F ||}
78
UP sup prime ~=~ UP over {|| UP ||}
82
Finally, let $s ~=~ f ~times~ UP sup prime$, and $u ~=~ s ~times~ f$.
85
M is then constructed as follows:
88
ccol { ~s[0] above ~u[0] above -f[0] above 0 }
89
ccol { ~s[1] above ~u[1] above -f[1] above 0 }
90
ccol { ~s[2] above ~u[2] above -f[2] above 0 }
91
ccol { 0 above 0 above 0 above 1 }
95
and \%\f3gluLookAt\fP is equivalent to
98
glTranslated (-eyex, -eyey, -eyez);
101
\f3glFrustum(3G)\fP, \%\f3gluPerspective(3G)\fP