1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
2 <!-- saved from url=(0013)about:internet -->
3 <?xml-stylesheet type=
"text/xsl" href=
"mathml.xsl"?><html xmlns=
"http://www.w3.org/1999/xhtml" xmlns:
pref=
"http://www.w3.org/2002/Math/preference" pref:
renderer=
"mathplayer-dl"><head><meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" /><title>gluLookAt
</title><meta name=
"generator" content=
"DocBook XSL Stylesheets V1.73.2" /></head><body><div class=
"refentry" lang=
"en" xml:
lang=
"en"><a id=
"gluLookAt"></a><div class=
"titlepage"></div><div class=
"refnamediv"><h2>Name
</h2><p>gluLookAt — define a viewing transformation
</p></div><div class=
"refsynopsisdiv"><h2>C Specification
</h2><div class=
"funcsynopsis"><table border=
"0" summary=
"Function synopsis" cellspacing=
"0" cellpadding=
"0"><tr><td><code class=
"funcdef">void
<b class=
"fsfunc">gluLookAt
</b>(
</code></td><td>GLdouble
</td><td><var class=
"pdparam">eyeX
</var>,
</td></tr><tr><td> </td><td>GLdouble
</td><td><var class=
"pdparam">eyeY
</var>,
</td></tr><tr><td> </td><td>GLdouble
</td><td><var class=
"pdparam">eyeZ
</var>,
</td></tr><tr><td> </td><td>GLdouble
</td><td><var class=
"pdparam">centerX
</var>,
</td></tr><tr><td> </td><td>GLdouble
</td><td><var class=
"pdparam">centerY
</var>,
</td></tr><tr><td> </td><td>GLdouble
</td><td><var class=
"pdparam">centerZ
</var>,
</td></tr><tr><td> </td><td>GLdouble
</td><td><var class=
"pdparam">upX
</var>,
</td></tr><tr><td> </td><td>GLdouble
</td><td><var class=
"pdparam">upY
</var>,
</td></tr><tr><td> </td><td>GLdouble
</td><td><var class=
"pdparam">upZ
</var><code>)
</code>;
</td></tr></table></div></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"parameters"></a><h2>Parameters
</h2><div class=
"variablelist"><dl><dt><span class=
"term"><em class=
"parameter"><code>eyeX
</code></em>,
</span><span class=
"term"><em class=
"parameter"><code>eyeY
</code></em>,
</span><span class=
"term"><em class=
"parameter"><code>eyeZ
</code></em></span></dt><dd><p>
4 Specifies the position of the eye point.
5 </p></dd><dt><span class=
"term"><em class=
"parameter"><code>centerX
</code></em>,
</span><span class=
"term"><em class=
"parameter"><code>centerY
</code></em>,
</span><span class=
"term"><em class=
"parameter"><code>centerZ
</code></em></span></dt><dd><p>
6 Specifies the position of the reference point.
7 </p></dd><dt><span class=
"term"><em class=
"parameter"><code>upX
</code></em>,
</span><span class=
"term"><em class=
"parameter"><code>upY
</code></em>,
</span><span class=
"term"><em class=
"parameter"><code>upZ
</code></em></span></dt><dd><p>
8 Specifies the direction of the
<span class=
"emphasis"><em>up
</em></span> vector.
9 </p></dd></dl></div></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"description"></a><h2>Description
</h2><p>
10 <code class=
"function">gluLookAt
</code> creates a viewing matrix derived from an eye point, a reference
11 point indicating the center of the scene, and an
<span class=
"emphasis"><em>UP
</em></span> vector.
14 maps the reference point to the negative
<span class=
"emphasis"><em>z
</em></span> axis and the
15 eye point to the origin.
16 When a typical projection matrix is used,
17 the center of the scene therefore maps to the center of the viewport.
18 Similarly, the direction described by the
<span class=
"emphasis"><em>UP
</em></span>
19 vector projected onto the viewing plane is mapped to the positive
<span class=
"emphasis"><em>y
</em></span>
20 axis so that it points upward in the viewport.
21 The
<span class=
"emphasis"><em>UP
</em></span> vector must not be parallel to the line of sight from the
22 eye point to the reference point.
26 </p><div class=
"informalequation"><mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
29 <mml:mi mathvariant=
"italic">F
</mml:mi>
31 <mml:mfenced open=
"(" close=
")">
36 <mml:mi mathvariant=
"italic">centerX
</mml:mi>
38 <mml:mi mathvariant=
"italic">eyeX
</mml:mi>
45 <mml:mi mathvariant=
"italic">centerY
</mml:mi>
47 <mml:mi mathvariant=
"italic">eyeY
</mml:mi>
54 <mml:mi mathvariant=
"italic">centerZ
</mml:mi>
56 <mml:mi mathvariant=
"italic">eyeZ
</mml:mi>
66 Let
<span class=
"emphasis"><em>UP
</em></span> be the vector
67 <mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
69 <mml:mfenced open=
"(" close=
")">
70 <mml:mi mathvariant=
"italic">upX
</mml:mi>
71 <mml:mi mathvariant=
"italic">upY
</mml:mi>
72 <mml:mi mathvariant=
"italic">upZ
</mml:mi>
76 Then normalize as follows:
77 </p><div class=
"informalequation"><mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
80 <mml:mi mathvariant=
"italic">f
</mml:mi>
83 <mml:mi mathvariant=
"italic">F
</mml:mi>
84 <mml:mfenced open=
"" close=
"">
85 <mml:mfenced open=
"∥" close=
"∥">
86 <mml:mi mathvariant=
"italic">F
</mml:mi>
93 </p><div class=
"informalequation"><mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
96 <mml:msup><mml:mi mathvariant=
"italic">UP
</mml:mi>
101 <mml:mi mathvariant=
"italic">UP
</mml:mi>
102 <mml:mfenced open=
"" close=
"">
103 <mml:mfenced open=
"∥" close=
"∥">
104 <mml:mi mathvariant=
"italic">UP
</mml:mi>
113 <mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
116 <mml:mi mathvariant=
"italic">s
</mml:mi>
119 <mml:mi mathvariant=
"italic">f
</mml:mi>
121 <mml:msup><mml:mi mathvariant=
"italic">UP
</mml:mi>
128 <mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
131 <mml:mi mathvariant=
"italic">u
</mml:mi>
134 <mml:mi mathvariant=
"italic">s
</mml:mi>
136 <mml:mi mathvariant=
"italic">f
</mml:mi>
142 M is then constructed as follows:
143 </p><div class=
"informalequation"><mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
146 <mml:mi mathvariant=
"italic">M
</mml:mi>
148 <mml:mfenced open=
"(" close=
")">
153 <mml:mi mathvariant=
"italic">s
</mml:mi>
155 <mml:mfenced open=
"[" close=
"]">
162 <mml:mi mathvariant=
"italic">s
</mml:mi>
164 <mml:mfenced open=
"[" close=
"]">
171 <mml:mi mathvariant=
"italic">s
</mml:mi>
173 <mml:mfenced open=
"[" close=
"]">
185 <mml:mi mathvariant=
"italic">u
</mml:mi>
187 <mml:mfenced open=
"[" close=
"]">
194 <mml:mi mathvariant=
"italic">u
</mml:mi>
196 <mml:mfenced open=
"[" close=
"]">
203 <mml:mi mathvariant=
"italic">u
</mml:mi>
205 <mml:mfenced open=
"[" close=
"]">
219 <mml:mi mathvariant=
"italic">f
</mml:mi>
221 <mml:mfenced open=
"[" close=
"]">
231 <mml:mi mathvariant=
"italic">f
</mml:mi>
233 <mml:mfenced open=
"[" close=
"]">
243 <mml:mi mathvariant=
"italic">f
</mml:mi>
245 <mml:mfenced open=
"[" close=
"]">
274 and
<code class=
"function">gluLookAt
</code> is equivalent to
275 </p><pre class=
"programlisting">
277 glTranslated(-eyex, -eyey, -eyez);
279 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"seealso"></a><h2>See Also
</h2><p>
280 <a class=
"citerefentry" href=
"gluPerspective.xml"><span class=
"citerefentry"><span class=
"refentrytitle">gluPerspective
</span></span></a>,
281 <a class=
"citerefentry" href=
"glFrustum.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glFrustum
</span></span></a>
282 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"Copyright"></a><h2>Copyright
</h2><p>
283 Copyright
<span class=
"trademark"></span>©
1991-
2006
284 Silicon Graphics, Inc. This document is licensed under the SGI
285 Free Software B License. For details, see
286 <a class=
"ulink" href=
"http://oss.sgi.com/projects/FreeB/" target=
"_top">http://oss.sgi.com/projects/FreeB/
</a>.
287 </p></div></div></body></html>