Commit | Line | Data |
---|---|---|
7faf1d71 AW |
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>gluProject</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="gluProject"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>gluProject — map object coordinates to window coordinates</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">GLint <b class="fsfunc">gluProject</b>(</code></td><td>GLdouble </td><td><var class="pdparam">objX</var>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">objY</var>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">objZ</var>, </td></tr><tr><td> </td><td>const GLdouble * </td><td><var class="pdparam">model</var>, </td></tr><tr><td> </td><td>const GLdouble * </td><td><var class="pdparam">proj</var>, </td></tr><tr><td> </td><td>const GLint * </td><td><var class="pdparam">view</var>, </td></tr><tr><td> </td><td>GLdouble* </td><td><var class="pdparam">winX</var>, </td></tr><tr><td> </td><td>GLdouble* </td><td><var class="pdparam">winY</var>, </td></tr><tr><td> </td><td>GLdouble* </td><td><var class="pdparam">winZ</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>objX</code></em>, </span><span class="term"><em class="parameter"><code>objY</code></em>, </span><span class="term"><em class="parameter"><code>objZ</code></em></span></dt><dd><p> | |
4 | Specify the object coordinates. | |
5 | </p></dd><dt><span class="term"><em class="parameter"><code>model</code></em></span></dt><dd><p> | |
6 | Specifies the current modelview matrix (as from a <a class="citerefentry" href="glGetDoublev.xml"><span class="citerefentry"><span class="refentrytitle">glGetDoublev</span></span></a> call). | |
7 | </p></dd><dt><span class="term"><em class="parameter"><code>proj</code></em></span></dt><dd><p> | |
8 | Specifies the current projection matrix (as from a <a class="citerefentry" href="glGetDoublev.xml"><span class="citerefentry"><span class="refentrytitle">glGetDoublev</span></span></a> call). | |
9 | </p></dd><dt><span class="term"><em class="parameter"><code>view</code></em></span></dt><dd><p> | |
10 | Specifies the current viewport (as from a <a class="citerefentry" href="glGetIntegerv.xml"><span class="citerefentry"><span class="refentrytitle">glGetIntegerv</span></span></a> call). | |
11 | </p></dd><dt><span class="term"><em class="parameter"><code>winX</code></em>, </span><span class="term"><em class="parameter"><code>winY</code></em>, </span><span class="term"><em class="parameter"><code>winZ</code></em></span></dt><dd><p> | |
12 | Return the computed window coordinates. | |
13 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
14 | <code class="function">gluProject</code> transforms the specified object coordinates into window coordinates | |
15 | using <em class="parameter"><code>model</code></em>, <em class="parameter"><code>proj</code></em>, and <em class="parameter"><code>view</code></em>. The result is stored | |
16 | in <em class="parameter"><code>winX</code></em>, <em class="parameter"><code>winY</code></em>, and <em class="parameter"><code>winZ</code></em>. A return value of | |
17 | <code class="constant">GLU_TRUE</code> indicates success, a return value of <code class="constant">GLU_FALSE</code> | |
18 | indicates failure. | |
19 | </p><p> | |
20 | To compute the coordinates, | |
21 | let | |
22 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
23 | ||
24 | <mml:mrow> | |
25 | <mml:mi mathvariant="italic">v</mml:mi> | |
26 | <mml:mo>=</mml:mo> | |
27 | <mml:mfenced open="(" close=")"> | |
28 | <mml:mi mathvariant="italic">objX</mml:mi> | |
29 | <mml:mi mathvariant="italic">objY</mml:mi> | |
30 | <mml:mi mathvariant="italic">objZ</mml:mi> | |
31 | <mml:mn>1.0</mml:mn> | |
32 | </mml:mfenced> | |
33 | </mml:mrow> | |
34 | </mml:math> | |
35 | represented as a matrix with 4 rows and 1 column. | |
36 | Then <code class="function">gluProject</code> computes | |
37 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
38 | ||
39 | <mml:msup><mml:mi mathvariant="italic">v</mml:mi> | |
40 | <mml:mo>″</mml:mo> | |
41 | </mml:msup> | |
42 | </mml:math> | |
43 | as follows: | |
44 | </p><p> | |
45 | </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
46 | ||
47 | <mml:mrow> | |
48 | <mml:msup><mml:mi mathvariant="italic">v</mml:mi> | |
49 | <mml:mo>″</mml:mo> | |
50 | </mml:msup> | |
51 | <mml:mo>=</mml:mo> | |
52 | <mml:mrow> | |
53 | <mml:mi mathvariant="italic">P</mml:mi> | |
54 | <mml:mo>×</mml:mo> | |
55 | <mml:mi mathvariant="italic">M</mml:mi> | |
56 | <mml:mo>×</mml:mo> | |
57 | <mml:mi mathvariant="italic">v</mml:mi> | |
58 | </mml:mrow> | |
59 | </mml:mrow> | |
60 | </mml:math></div><p> | |
61 | </p><p> | |
62 | where | |
63 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">P</mml:mi></mml:math> | |
64 | is the current projection matrix <em class="parameter"><code>proj</code></em> and | |
65 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">M</mml:mi></mml:math> | |
66 | is the current | |
67 | modelview matrix <em class="parameter"><code>model</code></em> (both represented as | |
68 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
69 | ||
70 | <mml:mrow> | |
71 | <mml:mn>4</mml:mn> | |
72 | <mml:mo>×</mml:mo> | |
73 | <mml:mn>4</mml:mn> | |
74 | </mml:mrow> | |
75 | </mml:math> | |
76 | matrices in column-major order). | |
77 | </p><p> | |
78 | The window coordinates are then computed as follows: | |
79 | </p><p> | |
80 | </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
81 | ||
82 | <mml:mrow> | |
83 | <mml:mi mathvariant="italic">winX</mml:mi> | |
84 | <mml:mo>=</mml:mo> | |
85 | <mml:mrow> | |
86 | <mml:mrow> | |
87 | <mml:mi mathvariant="italic">view</mml:mi> | |
88 | <mml:mo></mml:mo> | |
89 | <mml:mfenced open="(" close=")"> | |
90 | <mml:mn>0</mml:mn> | |
91 | </mml:mfenced> | |
92 | </mml:mrow> | |
93 | <mml:mo>+</mml:mo> | |
94 | <mml:mfrac> | |
95 | <mml:mrow> | |
96 | <mml:mrow> | |
97 | <mml:mi mathvariant="italic">view</mml:mi> | |
98 | <mml:mo></mml:mo> | |
99 | <mml:mfenced open="(" close=")"> | |
100 | <mml:mn>2</mml:mn> | |
101 | </mml:mfenced> | |
102 | </mml:mrow> | |
103 | <mml:mo>×</mml:mo> | |
104 | <mml:mfenced open="(" close=")"> | |
105 | <mml:mrow> | |
106 | <mml:mrow> | |
107 | <mml:msup><mml:mi mathvariant="italic">v</mml:mi> | |
108 | <mml:mo>″</mml:mo> | |
109 | </mml:msup> | |
110 | <mml:mo></mml:mo> | |
111 | <mml:mfenced open="(" close=")"> | |
112 | <mml:mn>0</mml:mn> | |
113 | </mml:mfenced> | |
114 | </mml:mrow> | |
115 | <mml:mo>+</mml:mo> | |
116 | <mml:mn>1</mml:mn> | |
117 | </mml:mrow> | |
118 | </mml:mfenced> | |
119 | </mml:mrow> | |
120 | <mml:mn>2</mml:mn> | |
121 | </mml:mfrac> | |
122 | </mml:mrow> | |
123 | </mml:mrow> | |
124 | </mml:math></div><p> | |
125 | </p><p> | |
126 | </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
127 | ||
128 | <mml:mrow> | |
129 | <mml:mi mathvariant="italic">winY</mml:mi> | |
130 | <mml:mo>=</mml:mo> | |
131 | <mml:mrow> | |
132 | <mml:mrow> | |
133 | <mml:mi mathvariant="italic">view</mml:mi> | |
134 | <mml:mo></mml:mo> | |
135 | <mml:mfenced open="(" close=")"> | |
136 | <mml:mn>1</mml:mn> | |
137 | </mml:mfenced> | |
138 | </mml:mrow> | |
139 | <mml:mo>+</mml:mo> | |
140 | <mml:mfrac> | |
141 | <mml:mrow> | |
142 | <mml:mrow> | |
143 | <mml:mi mathvariant="italic">view</mml:mi> | |
144 | <mml:mo></mml:mo> | |
145 | <mml:mfenced open="(" close=")"> | |
146 | <mml:mn>3</mml:mn> | |
147 | </mml:mfenced> | |
148 | </mml:mrow> | |
149 | <mml:mo>×</mml:mo> | |
150 | <mml:mfenced open="(" close=")"> | |
151 | <mml:mrow> | |
152 | <mml:mrow> | |
153 | <mml:msup><mml:mi mathvariant="italic">v</mml:mi> | |
154 | <mml:mo>″</mml:mo> | |
155 | </mml:msup> | |
156 | <mml:mo></mml:mo> | |
157 | <mml:mfenced open="(" close=")"> | |
158 | <mml:mn>1</mml:mn> | |
159 | </mml:mfenced> | |
160 | </mml:mrow> | |
161 | <mml:mo>+</mml:mo> | |
162 | <mml:mn>1</mml:mn> | |
163 | </mml:mrow> | |
164 | </mml:mfenced> | |
165 | </mml:mrow> | |
166 | <mml:mn>2</mml:mn> | |
167 | </mml:mfrac> | |
168 | </mml:mrow> | |
169 | </mml:mrow> | |
170 | </mml:math></div><p> | |
171 | </p><p> | |
172 | </p><p> | |
173 | </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
174 | ||
175 | <mml:mrow> | |
176 | <mml:mi mathvariant="italic">winZ</mml:mi> | |
177 | <mml:mo>=</mml:mo> | |
178 | <mml:mfrac> | |
179 | <mml:mfenced open="(" close=")"> | |
180 | <mml:mrow> | |
181 | <mml:mrow> | |
182 | <mml:msup><mml:mi mathvariant="italic">v</mml:mi> | |
183 | <mml:mo>″</mml:mo> | |
184 | </mml:msup> | |
185 | <mml:mo></mml:mo> | |
186 | <mml:mfenced open="(" close=")"> | |
187 | <mml:mn>2</mml:mn> | |
188 | </mml:mfenced> | |
189 | </mml:mrow> | |
190 | <mml:mo>+</mml:mo> | |
191 | <mml:mn>1</mml:mn> | |
192 | </mml:mrow> | |
193 | </mml:mfenced> | |
194 | <mml:mn>2</mml:mn> | |
195 | </mml:mfrac> | |
196 | </mml:mrow> | |
197 | </mml:math></div><p> | |
198 | </p><p> | |
199 | </p><p> | |
200 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
201 | <a class="citerefentry" href="gluUnProject.xml"><span class="citerefentry"><span class="refentrytitle">gluUnProject</span></span></a>, | |
202 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> | |
203 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
204 | Copyright <span class="trademark"></span>© 1991-2006 | |
205 | Silicon Graphics, Inc. This document is licensed under the SGI | |
206 | Free Software B License. For details, see | |
207 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
208 | </p></div></div></body></html> |