'\" e '\"macro stdmacro .ds Vn Version 1.2 .ds Dt 6 March 1997 .ds Re Release 1.2.0 .ds Dp May 22 14:54 .ds Dm 9 May 22 14: .ds Xs 01014 4 .TH GLULOOKAT 3G .SH NAME .B "gluLookAt \- define a viewing transformation .SH C SPECIFICATION void \f3gluLookAt\fP( GLdouble \fIeyeX\fP, .nf .ta \w'\f3void \fPgluLookAt( 'u GLdouble \fIeyeY\fP, GLdouble \fIeyeZ\fP, GLdouble \fIcenterX\fP, GLdouble \fIcenterY\fP, GLdouble \fIcenterZ\fP, GLdouble \fIupX\fP, GLdouble \fIupY\fP, GLdouble \fIupZ\fP ) .fi .SH PARAMETERS .TP \w'\f2eyeX\fP\ \f2eyeY\fP\ \f2eyeZ\fP\ \ 'u \f2eyeX\fP, \f2eyeY\fP, \f2eyeZ\fP Specifies the position of the eye point. .TP \f2centerX\fP, \f2centerY\fP, \f2centerZ\fP Specifies the position of the reference point. .TP \f2upX\fP, \f2upY\fP, \f2upZ\fP Specifies the direction of the \f2up\fP vector. .SH DESCRIPTION \%\f3gluLookAt\fP creates a viewing matrix derived from an eye point, a reference point indicating the center of the scene, and an \f2UP\fP vector. .P The matrix maps the reference point to the negative \f2z\fP axis and the eye point to the origin. When a typical projection matrix is used, the center of the scene therefore maps to the center of the viewport. Similarly, the direction described by the \f2UP\fP vector projected onto the viewing plane is mapped to the positive \f2y\fP axis so that it points upward in the viewport. The \f2UP\fP vector must not be parallel to the line of sight from the eye point to the reference point. .P Let .Bd -literal centerX - eyeX F = centerY - eyeY centerZ - eyeZ .Ed Let \f2UP\fP be the vector (upX, upY, upZ). .P Then normalize as follows: f = F/ || F || UP' = UP/|| UP || Finally, let s = f X UP', and u = s X f. M is then constructed as follows: .Bd -literal s[0] s[1] s[2] 0 u[0] u[1] u[2] 0 M = -f[0] -f[1] -f[2] 0 0 0 0 1 .Ed and \%\f3gluLookAt\fP is equivalent to glMultMatrixf(M); glTranslated (-eyeX, -eyeY, -eyeZ); .Ee .SH SEE ALSO \f3glFrustum\fP, \%\f3gluPerspective\fP