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=
"gluProject">
9 <holder>Silicon Graphics, Inc.
</holder>
12 <refentrytitle>gluProject
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>gluProject
</refname>
17 <refpurpose>map object coordinates to window coordinates
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>GLint
<function>gluProject
</function></funcdef>
23 <paramdef>GLdouble
<parameter>objX
</parameter></paramdef>
24 <paramdef>GLdouble
<parameter>objY
</parameter></paramdef>
25 <paramdef>GLdouble
<parameter>objZ
</parameter></paramdef>
26 <paramdef>const GLdouble *
<parameter>model
</parameter></paramdef>
27 <paramdef>const GLdouble *
<parameter>proj
</parameter></paramdef>
28 <paramdef>const GLint *
<parameter>view
</parameter></paramdef>
29 <paramdef>GLdouble*
<parameter>winX
</parameter></paramdef>
30 <paramdef>GLdouble*
<parameter>winY
</parameter></paramdef>
31 <paramdef>GLdouble*
<parameter>winZ
</parameter></paramdef>
35 <!-- eqn: ignoring delim $$ -->
36 <refsect1 id=
"parameters"><title>Parameters
</title>
39 <term><parameter>objX
</parameter></term>
40 <term><parameter>objY
</parameter></term>
41 <term><parameter>objZ
</parameter></term>
44 Specify the object coordinates.
49 <term><parameter>model
</parameter></term>
52 Specifies the current modelview matrix (as from a
<citerefentry><refentrytitle>glGetDoublev
</refentrytitle></citerefentry> call).
57 <term><parameter>proj
</parameter></term>
60 Specifies the current projection matrix (as from a
<citerefentry><refentrytitle>glGetDoublev
</refentrytitle></citerefentry> call).
65 <term><parameter>view
</parameter></term>
68 Specifies the current viewport (as from a
<citerefentry><refentrytitle>glGetIntegerv
</refentrytitle></citerefentry> call).
73 <term><parameter>winX
</parameter></term>
74 <term><parameter>winY
</parameter></term>
75 <term><parameter>winZ
</parameter></term>
78 Return the computed window coordinates.
84 <refsect1 id=
"description"><title>Description
</title>
86 <function>gluProject
</function> transforms the specified object coordinates into window coordinates
87 using
<parameter>model
</parameter>,
<parameter>proj
</parameter>, and
<parameter>view
</parameter>. The result is stored
88 in
<parameter>winX
</parameter>,
<parameter>winY
</parameter>, and
<parameter>winZ
</parameter>. A return value of
89 <constant>GLU_TRUE
</constant> indicates success, a return value of
<constant>GLU_FALSE
</constant>
93 To compute the coordinates,
95 <inlineequation><mml:math>
96 <!-- eqn: v = (objX, objY, objZ, 1.0):-->
98 <mml:mi mathvariant=
"italic">v
</mml:mi>
100 <mml:mfenced open=
"(" close=
")">
101 <mml:mi mathvariant=
"italic">objX
</mml:mi>
102 <mml:mi mathvariant=
"italic">objY
</mml:mi>
103 <mml:mi mathvariant=
"italic">objZ
</mml:mi>
107 </mml:math></inlineequation>
108 represented as a matrix with
4 rows and
1 column.
109 Then
<function>gluProject
</function> computes
110 <inlineequation><mml:math>
111 <!-- eqn: v sup prime:-->
112 <mml:msup><mml:mi mathvariant=
"italic">v
</mml:mi>
113 <mml:mo>″</mml:mo>
115 </mml:math></inlineequation>
119 <informalequation><mml:math>
120 <!-- eqn: v sup prime = P times M times v:-->
122 <mml:msup><mml:mi mathvariant=
"italic">v
</mml:mi>
123 <mml:mo>″</mml:mo>
127 <mml:mi mathvariant=
"italic">P
</mml:mi>
128 <mml:mo>×</mml:mo>
129 <mml:mi mathvariant=
"italic">M
</mml:mi>
130 <mml:mo>×</mml:mo>
131 <mml:mi mathvariant=
"italic">v
</mml:mi>
134 </mml:math></informalequation>
138 <inlineequation><mml:math><mml:mi mathvariant=
"italic">P
</mml:mi></mml:math></inlineequation>
139 is the current projection matrix
<parameter>proj
</parameter> and
140 <inlineequation><mml:math><mml:mi mathvariant=
"italic">M
</mml:mi></mml:math></inlineequation>
142 modelview matrix
<parameter>model
</parameter> (both represented as
143 <inlineequation><mml:math>
144 <!-- eqn: 4 times 4:-->
147 <mml:mo>×</mml:mo>
150 </mml:math></inlineequation>
151 matrices in column-major order).
154 The window coordinates are then computed as follows:
157 <informalequation><mml:math>
158 <!-- eqn: winX = view (0) + view (2) * (v sup prime (0) + 1) / 2:-->
160 <mml:mi mathvariant=
"italic">winX
</mml:mi>
164 <mml:mi mathvariant=
"italic">view
</mml:mi>
165 <mml:mo>⁡</mml:mo>
166 <mml:mfenced open=
"(" close=
")">
174 <mml:mi mathvariant=
"italic">view
</mml:mi>
175 <mml:mo>⁡</mml:mo>
176 <mml:mfenced open=
"(" close=
")">
180 <mml:mo>×</mml:mo>
181 <mml:mfenced open=
"(" close=
")">
184 <mml:msup><mml:mi mathvariant=
"italic">v
</mml:mi>
185 <mml:mo>″</mml:mo>
187 <mml:mo>⁡</mml:mo>
188 <mml:mfenced open=
"(" close=
")">
201 </mml:math></informalequation>
203 <informalequation><mml:math>
204 <!-- eqn: winY = view (1) + view (3) * (v sup prime (1) + 1) / 2:-->
206 <mml:mi mathvariant=
"italic">winY
</mml:mi>
210 <mml:mi mathvariant=
"italic">view
</mml:mi>
211 <mml:mo>⁡</mml:mo>
212 <mml:mfenced open=
"(" close=
")">
220 <mml:mi mathvariant=
"italic">view
</mml:mi>
221 <mml:mo>⁡</mml:mo>
222 <mml:mfenced open=
"(" close=
")">
226 <mml:mo>×</mml:mo>
227 <mml:mfenced open=
"(" close=
")">
230 <mml:msup><mml:mi mathvariant=
"italic">v
</mml:mi>
231 <mml:mo>″</mml:mo>
233 <mml:mo>⁡</mml:mo>
234 <mml:mfenced open=
"(" close=
")">
247 </mml:math></informalequation>
250 <informalequation><mml:math>
251 <!-- eqn: winZ = (v sup prime (2) + 1) / 2:-->
253 <mml:mi mathvariant=
"italic">winZ
</mml:mi>
256 <mml:mfenced open=
"(" close=
")">
259 <mml:msup><mml:mi mathvariant=
"italic">v
</mml:mi>
260 <mml:mo>″</mml:mo>
262 <mml:mo>⁡</mml:mo>
263 <mml:mfenced open=
"(" close=
")">
274 </mml:math></informalequation>
280 <refsect1 id=
"seealso"><title>See Also
</title>
282 <citerefentry><refentrytitle>gluUnProject
</refentrytitle></citerefentry>,
283 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry>
286 <refsect1 id=
"Copyright"><title>Copyright
</title>
288 Copyright
<trademark class=
"copyright"></trademark> 1991-
2006
289 Silicon Graphics, Inc. This document is licensed under the SGI
290 Free Software B License. For details, see
291 <ulink url=
"http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/
</ulink>.