1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"gluLookAt">
9 <holder>Silicon Graphics, Inc.
</holder>
12 <refentrytitle>gluLookAt
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>gluLookAt
</refname>
17 <refpurpose>define a viewing transformation
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>gluLookAt
</function></funcdef>
23 <paramdef>GLdouble
<parameter>eyeX
</parameter></paramdef>
24 <paramdef>GLdouble
<parameter>eyeY
</parameter></paramdef>
25 <paramdef>GLdouble
<parameter>eyeZ
</parameter></paramdef>
26 <paramdef>GLdouble
<parameter>centerX
</parameter></paramdef>
27 <paramdef>GLdouble
<parameter>centerY
</parameter></paramdef>
28 <paramdef>GLdouble
<parameter>centerZ
</parameter></paramdef>
29 <paramdef>GLdouble
<parameter>upX
</parameter></paramdef>
30 <paramdef>GLdouble
<parameter>upY
</parameter></paramdef>
31 <paramdef>GLdouble
<parameter>upZ
</parameter></paramdef>
35 <!-- eqn: ignoring delim $$ -->
36 <refsect1 id=
"parameters"><title>Parameters
</title>
39 <term><parameter>eyeX
</parameter></term>
40 <term><parameter>eyeY
</parameter></term>
41 <term><parameter>eyeZ
</parameter></term>
44 Specifies the position of the eye point.
49 <term><parameter>centerX
</parameter></term>
50 <term><parameter>centerY
</parameter></term>
51 <term><parameter>centerZ
</parameter></term>
54 Specifies the position of the reference point.
59 <term><parameter>upX
</parameter></term>
60 <term><parameter>upY
</parameter></term>
61 <term><parameter>upZ
</parameter></term>
64 Specifies the direction of the
<emphasis>up
</emphasis> vector.
70 <refsect1 id=
"description"><title>Description
</title>
72 <function>gluLookAt
</function> creates a viewing matrix derived from an eye point, a reference
73 point indicating the center of the scene, and an
<emphasis>UP
</emphasis> vector.
77 maps the reference point to the negative
<emphasis>z
</emphasis> axis and the
78 eye point to the origin.
79 When a typical projection matrix is used,
80 the center of the scene therefore maps to the center of the viewport.
81 Similarly, the direction described by the
<emphasis>UP
</emphasis>
82 vector projected onto the viewing plane is mapped to the positive
<emphasis>y
</emphasis>
83 axis so that it points upward in the viewport.
84 The
<emphasis>UP
</emphasis> vector must not be parallel to the line of sight from the
85 eye point to the reference point.
91 <informalequation><mml:math>
92 <!-- eqn: F = left ( matrix { ccol { centerX - eyeX above centerY - eyeY above centerZ - eyeZ } } right ):-->
94 <mml:mi mathvariant=
"italic">F
</mml:mi>
96 <mml:mfenced open=
"(" close=
")">
101 <mml:mi mathvariant=
"italic">centerX
</mml:mi>
103 <mml:mi mathvariant=
"italic">eyeX
</mml:mi>
110 <mml:mi mathvariant=
"italic">centerY
</mml:mi>
112 <mml:mi mathvariant=
"italic">eyeY
</mml:mi>
119 <mml:mi mathvariant=
"italic">centerZ
</mml:mi>
121 <mml:mi mathvariant=
"italic">eyeZ
</mml:mi>
128 </mml:math></informalequation>
133 Let
<emphasis>UP
</emphasis> be the vector
134 <inlineequation><mml:math>
135 <!-- eqn: (upX, upY, upZ):-->
136 <mml:mfenced open=
"(" close=
")">
137 <mml:mi mathvariant=
"italic">upX
</mml:mi>
138 <mml:mi mathvariant=
"italic">upY
</mml:mi>
139 <mml:mi mathvariant=
"italic">upZ
</mml:mi>
141 </mml:math></inlineequation>.
144 Then normalize as follows:
145 <informalequation><mml:math>
146 <!-- eqn: f = F over {|| F ||}:-->
148 <mml:mi mathvariant=
"italic">f
</mml:mi>
151 <mml:mi mathvariant=
"italic">F
</mml:mi>
152 <mml:mfenced open=
"" close=
"">
153 <mml:mfenced open=
"∥" close=
"∥">
154 <mml:mi mathvariant=
"italic">F
</mml:mi>
159 </mml:math></informalequation>
162 <informalequation><mml:math>
163 <!-- eqn: UP sup prime = UP over {|| UP ||}:-->
165 <mml:msup><mml:mi mathvariant=
"italic">UP
</mml:mi>
166 <mml:mo>″</mml:mo>
170 <mml:mi mathvariant=
"italic">UP
</mml:mi>
171 <mml:mfenced open=
"" close=
"">
172 <mml:mfenced open=
"∥" close=
"∥">
173 <mml:mi mathvariant=
"italic">UP
</mml:mi>
178 </mml:math></informalequation>
184 <inlineequation><mml:math>
185 <!-- eqn: s = f times UP sup prime:-->
187 <mml:mi mathvariant=
"italic">s
</mml:mi>
190 <mml:mi mathvariant=
"italic">f
</mml:mi>
191 <mml:mo>×</mml:mo>
192 <mml:msup><mml:mi mathvariant=
"italic">UP
</mml:mi>
193 <mml:mo>″</mml:mo>
197 </mml:math></inlineequation>,
199 <inlineequation><mml:math>
200 <!-- eqn: u = s times f:-->
202 <mml:mi mathvariant=
"italic">u
</mml:mi>
205 <mml:mi mathvariant=
"italic">s
</mml:mi>
206 <mml:mo>×</mml:mo>
207 <mml:mi mathvariant=
"italic">f
</mml:mi>
210 </mml:math></inlineequation>.
215 M is then constructed as follows:
216 <informalequation><mml:math>
217 <!-- eqn: M = left ( matrix { ccol { s[0] above u[0] above -f[0] above 0 } ccol { s[1] above u[1] above -f[1] above 0 } ccol { s[2] above u[2] above -f[2] above 0 } ccol { 0 above 0 above 0 above 1 } } right ):-->
219 <mml:mi mathvariant=
"italic">M
</mml:mi>
221 <mml:mfenced open=
"(" close=
")">
226 <mml:mi mathvariant=
"italic">s
</mml:mi>
227 <mml:mo>⁡</mml:mo>
228 <mml:mfenced open=
"[" close=
"]">
235 <mml:mi mathvariant=
"italic">s
</mml:mi>
236 <mml:mo>⁡</mml:mo>
237 <mml:mfenced open=
"[" close=
"]">
244 <mml:mi mathvariant=
"italic">s
</mml:mi>
245 <mml:mo>⁡</mml:mo>
246 <mml:mfenced open=
"[" close=
"]">
258 <mml:mi mathvariant=
"italic">u
</mml:mi>
259 <mml:mo>⁡</mml:mo>
260 <mml:mfenced open=
"[" close=
"]">
267 <mml:mi mathvariant=
"italic">u
</mml:mi>
268 <mml:mo>⁡</mml:mo>
269 <mml:mfenced open=
"[" close=
"]">
276 <mml:mi mathvariant=
"italic">u
</mml:mi>
277 <mml:mo>⁡</mml:mo>
278 <mml:mfenced open=
"[" close=
"]">
292 <mml:mi mathvariant=
"italic">f
</mml:mi>
293 <mml:mo>⁡</mml:mo>
294 <mml:mfenced open=
"[" close=
"]">
304 <mml:mi mathvariant=
"italic">f
</mml:mi>
305 <mml:mo>⁡</mml:mo>
306 <mml:mfenced open=
"[" close=
"]">
316 <mml:mi mathvariant=
"italic">f
</mml:mi>
317 <mml:mo>⁡</mml:mo>
318 <mml:mfenced open=
"[" close=
"]">
345 </mml:math></informalequation>
348 and
<function>gluLookAt
</function> is equivalent to
351 glTranslated(-eyex, -eyey, -eyez);
355 <refsect1 id=
"seealso"><title>See Also
</title>
357 <citerefentry><refentrytitle>gluPerspective
</refentrytitle></citerefentry>,
358 <citerefentry><refentrytitle>glFrustum
</refentrytitle></citerefentry>
361 <refsect1 id=
"Copyright"><title>Copyright
</title>
363 Copyright
<trademark class=
"copyright"></trademark> 1991-
2006
364 Silicon Graphics, Inc. This document is licensed under the SGI
365 Free Software B License. For details, see
366 <ulink url=
"http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/
</ulink>.