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>gluUnProject4</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="gluUnProject4"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>gluUnProject4 — map window and clip coordinates to object 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">gluUnProject4</b>(</code></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>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">clipW</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">nearVal</var>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">farVal</var>, </td></tr><tr><td> </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>GLdouble* </td><td><var class="pdparam">objW</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>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> | |
4 | Specify the window coordinates to be mapped. | |
5 | </p></dd><dt><span class="term"><em class="parameter"><code>clipW</code></em></span></dt><dd><p> | |
6 | Specify the clip w coordinate to be mapped. | |
7 | </p></dd><dt><span class="term"><em class="parameter"><code>model</code></em></span></dt><dd><p> | |
8 | Specifies the modelview 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>proj</code></em></span></dt><dd><p> | |
10 | Specifies the projection matrix (as from a <a class="citerefentry" href="glGetDoublev.xml"><span class="citerefentry"><span class="refentrytitle">glGetDoublev</span></span></a> call). | |
11 | </p></dd><dt><span class="term"><em class="parameter"><code>view</code></em></span></dt><dd><p> | |
12 | Specifies the viewport (as from a <a class="citerefentry" href="glGetIntegerv.xml"><span class="citerefentry"><span class="refentrytitle">glGetIntegerv</span></span></a> call). | |
13 | </p></dd><dt><span class="term"><em class="parameter"><code>nearVal</code></em>, </span><span class="term"><em class="parameter"><code>farVal</code></em></span></dt><dd><p> | |
14 | Specifies the near and far planes (as from a <a class="citerefentry" href="glGetDoublev.xml"><span class="citerefentry"><span class="refentrytitle">glGetDoublev</span></span></a> call). | |
15 | </p></dd><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><span class="term"><em class="parameter"><code>objW</code></em></span></dt><dd><p> | |
16 | Returns the computed object coordinates. | |
17 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
18 | <code class="function">gluUnProject4</code> maps the specified window coordinatesi: <em class="parameter"><code>winX</code></em>, <em class="parameter"><code>winY</code></em>, and <em class="parameter"><code>winZ</code></em> | |
19 | and its clip w coordinate <em class="parameter"><code>clipW</code></em> | |
20 | into object | |
21 | coordinates | |
22 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
23 | ||
24 | <mml:mfenced open="(" close=")"> | |
25 | <mml:mi mathvariant="italic">objX</mml:mi> | |
26 | <mml:mi mathvariant="italic">objY</mml:mi> | |
27 | <mml:mi mathvariant="italic">objZ</mml:mi> | |
28 | <mml:mi mathvariant="italic">objW</mml:mi> | |
29 | </mml:mfenced> | |
30 | </mml:math> | |
31 | using <em class="parameter"><code>model</code></em>, <em class="parameter"><code>proj</code></em>, and <em class="parameter"><code>view</code></em>. <em class="parameter"><code>clipW</code></em> can be other than | |
32 | 1 as for vertices in <a class="citerefentry" href="glFeedbackBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glFeedbackBuffer</span></span></a> when data type | |
33 | <code class="constant">GLU_4D_COLOR_TEXTURE</code> is returned. | |
34 | This also handles the case | |
35 | where the <em class="parameter"><code>nearVal</code></em> and <em class="parameter"><code>farVal</code></em> planes are different from the default, | |
36 | 0 and 1, respectively. | |
37 | A return | |
38 | value of <code class="constant">GLU_TRUE</code> indicates success; a return value of <code class="constant">GLU_FALSE</code> | |
39 | indicates failure. | |
40 | </p><p> | |
41 | To compute the coordinates | |
42 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
43 | ||
44 | <mml:mfenced open="(" close=")"> | |
45 | <mml:mi mathvariant="italic">objX</mml:mi> | |
46 | <mml:mi mathvariant="italic">objY</mml:mi> | |
47 | <mml:mi mathvariant="italic">objZ</mml:mi> | |
48 | <mml:mi mathvariant="italic">objW</mml:mi> | |
49 | </mml:mfenced> | |
50 | </mml:math>, | |
51 | <code class="function">gluUnProject4</code> multiplies the normalized device coordinates by the inverse of | |
52 | <em class="parameter"><code>model</code></em> * <em class="parameter"><code>proj</code></em> as follows: | |
53 | </p><p> | |
54 | </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
55 | ||
56 | <mml:mrow> | |
57 | <mml:mfenced open="(" close=")"> | |
58 | <mml:mtable> | |
59 | <mml:mtr><mml:mtd> | |
60 | <mml:mi mathvariant="italic">objX</mml:mi> | |
61 | </mml:mtd></mml:mtr> | |
62 | <mml:mtr><mml:mtd> | |
63 | <mml:mi mathvariant="italic">objY</mml:mi> | |
64 | </mml:mtd></mml:mtr> | |
65 | <mml:mtr><mml:mtd> | |
66 | <mml:mi mathvariant="italic">objZ</mml:mi> | |
67 | </mml:mtd></mml:mtr> | |
68 | <mml:mtr><mml:mtd> | |
69 | <mml:mi mathvariant="italic">objW</mml:mi> | |
70 | </mml:mtd></mml:mtr> | |
71 | </mml:mtable> | |
72 | </mml:mfenced> | |
73 | <mml:mo>=</mml:mo> | |
74 | <mml:mrow> | |
75 | <mml:mrow> | |
76 | <mml:mi mathvariant="italic">INV</mml:mi> | |
77 | <mml:mo></mml:mo> | |
78 | <mml:mfenced open="(" close=")"> | |
79 | <mml:mrow> | |
80 | <mml:mi mathvariant="italic">P</mml:mi> | |
81 | <mml:mo></mml:mo> | |
82 | <mml:mi mathvariant="italic">M</mml:mi> | |
83 | </mml:mrow> | |
84 | </mml:mfenced> | |
85 | </mml:mrow> | |
86 | <mml:mo></mml:mo> | |
87 | <mml:mfenced open="(" close=")"> | |
88 | <mml:mtable> | |
89 | <mml:mtr><mml:mtd> | |
90 | <mml:mrow> | |
91 | <mml:mfrac> | |
92 | <mml:mfenced open="" close=""> | |
93 | <mml:mrow> | |
94 | <mml:mn>2</mml:mn> | |
95 | <mml:mo></mml:mo> | |
96 | <mml:mfenced open="(" close=")"> | |
97 | <mml:mrow> | |
98 | <mml:mi mathvariant="italic">winX</mml:mi> | |
99 | <mml:mo>-</mml:mo> | |
100 | <mml:mrow> | |
101 | <mml:mi mathvariant="italic">view</mml:mi> | |
102 | <mml:mo></mml:mo> | |
103 | <mml:mfenced open="[" close="]"> | |
104 | <mml:mn>0</mml:mn> | |
105 | </mml:mfenced> | |
106 | </mml:mrow> | |
107 | </mml:mrow> | |
108 | </mml:mfenced> | |
109 | </mml:mrow> | |
110 | </mml:mfenced> | |
111 | <mml:mfenced open="" close=""> | |
112 | <mml:mrow> | |
113 | <mml:mi mathvariant="italic">view</mml:mi> | |
114 | <mml:mo></mml:mo> | |
115 | <mml:mfenced open="[" close="]"> | |
116 | <mml:mn>2</mml:mn> | |
117 | </mml:mfenced> | |
118 | </mml:mrow> | |
119 | </mml:mfenced> | |
120 | </mml:mfrac> | |
121 | <mml:mo>-</mml:mo> | |
122 | <mml:mn>1</mml:mn> | |
123 | </mml:mrow> | |
124 | </mml:mtd></mml:mtr> | |
125 | <mml:mtr><mml:mtd> | |
126 | <mml:mrow> | |
127 | <mml:mfrac> | |
128 | <mml:mfenced open="" close=""> | |
129 | <mml:mrow> | |
130 | <mml:mn>2</mml:mn> | |
131 | <mml:mo></mml:mo> | |
132 | <mml:mfenced open="(" close=")"> | |
133 | <mml:mrow> | |
134 | <mml:mi mathvariant="italic">winY</mml:mi> | |
135 | <mml:mo>-</mml:mo> | |
136 | <mml:mrow> | |
137 | <mml:mi mathvariant="italic">view</mml:mi> | |
138 | <mml:mo></mml:mo> | |
139 | <mml:mfenced open="[" close="]"> | |
140 | <mml:mn>1</mml:mn> | |
141 | </mml:mfenced> | |
142 | </mml:mrow> | |
143 | </mml:mrow> | |
144 | </mml:mfenced> | |
145 | </mml:mrow> | |
146 | </mml:mfenced> | |
147 | <mml:mfenced open="" close=""> | |
148 | <mml:mrow> | |
149 | <mml:mi mathvariant="italic">view</mml:mi> | |
150 | <mml:mo></mml:mo> | |
151 | <mml:mfenced open="[" close="]"> | |
152 | <mml:mn>3</mml:mn> | |
153 | </mml:mfenced> | |
154 | </mml:mrow> | |
155 | </mml:mfenced> | |
156 | </mml:mfrac> | |
157 | <mml:mo>-</mml:mo> | |
158 | <mml:mn>1</mml:mn> | |
159 | </mml:mrow> | |
160 | </mml:mtd></mml:mtr> | |
161 | <mml:mtr><mml:mtd> | |
162 | <mml:mrow> | |
163 | <mml:mfrac> | |
164 | <mml:mfenced open="" close=""> | |
165 | <mml:mrow> | |
166 | <mml:mn>2</mml:mn> | |
167 | <mml:mo></mml:mo> | |
168 | <mml:mfenced open="(" close=")"> | |
169 | <mml:mrow> | |
170 | <mml:mi mathvariant="italic">winZ</mml:mi> | |
171 | <mml:mo>-</mml:mo> | |
172 | <mml:mi mathvariant="italic">nearVal</mml:mi> | |
173 | </mml:mrow> | |
174 | </mml:mfenced> | |
175 | </mml:mrow> | |
176 | </mml:mfenced> | |
177 | <mml:mfenced open="" close=""> | |
178 | <mml:mfenced open="(" close=")"> | |
179 | <mml:mrow> | |
180 | <mml:mi mathvariant="italic">farVal</mml:mi> | |
181 | <mml:mo>-</mml:mo> | |
182 | <mml:mi mathvariant="italic">nearVal</mml:mi> | |
183 | </mml:mrow> | |
184 | </mml:mfenced> | |
185 | </mml:mfenced> | |
186 | </mml:mfrac> | |
187 | <mml:mo>-</mml:mo> | |
188 | <mml:mn>1</mml:mn> | |
189 | </mml:mrow> | |
190 | </mml:mtd></mml:mtr> | |
191 | <mml:mtr><mml:mtd> | |
192 | <mml:mi mathvariant="italic">clipW</mml:mi> | |
193 | </mml:mtd></mml:mtr> | |
194 | </mml:mtable> | |
195 | </mml:mfenced> | |
196 | </mml:mrow> | |
197 | </mml:mrow> | |
198 | </mml:math></div><p> | |
199 | </p><p> | |
200 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">INV</mml:mi></mml:math> | |
201 | denotes matrix inversion. | |
202 | </p><p> | |
203 | <code class="function">gluUnProject4</code> is equivalent to <a class="citerefentry" href="gluUnProject.xml"><span class="citerefentry"><span class="refentrytitle">gluUnProject</span></span></a> when <em class="parameter"><code>clipW</code></em> is 1, <em class="parameter"><code>nearVal</code></em> is 0, and | |
204 | <em class="parameter"><code>farVal</code></em> is 1. | |
205 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
206 | <code class="function">gluUnProject4</code> is available only if the GLU version is 1.3 or greater. | |
207 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
208 | <a class="citerefentry" href="gluProject.xml"><span class="citerefentry"><span class="refentrytitle">gluProject</span></span></a>, | |
209 | <a class="citerefentry" href="gluUnProject.xml"><span class="citerefentry"><span class="refentrytitle">gluUnProject</span></span></a>, | |
210 | <a class="citerefentry" href="glFeedbackBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glFeedbackBuffer</span></span></a>, | |
211 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> | |
212 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
213 | Copyright <span class="trademark"></span>© 1991-2006 | |
214 | Silicon Graphics, Inc. This document is licensed under the SGI | |
215 | Free Software B License. For details, see | |
216 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
217 | </p></div></div></body></html> |