Commit | Line | Data |
---|---|---|
7faf1d71 AW |
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="glTexGen"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>1991-2006</year> | |
9 | <holder>Silicon Graphics, Inc.</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>glTexGen</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>glTexGen</refname> | |
17 | <refpurpose>control the generation of texture coordinates</refpurpose> | |
18 | </refnamediv> | |
19 | <refsynopsisdiv><title>C Specification</title> | |
20 | <funcsynopsis> | |
21 | <funcprototype> | |
22 | <funcdef>void <function>glTexGeni</function></funcdef> | |
23 | <paramdef>GLenum <parameter>coord</parameter></paramdef> | |
24 | <paramdef>GLenum <parameter>pname</parameter></paramdef> | |
25 | <paramdef>GLint <parameter>param</parameter></paramdef> | |
26 | </funcprototype> | |
27 | </funcsynopsis> | |
28 | <funcsynopsis> | |
29 | <funcprototype> | |
30 | <funcdef>void <function>glTexGenf</function></funcdef> | |
31 | <paramdef>GLenum <parameter>coord</parameter></paramdef> | |
32 | <paramdef>GLenum <parameter>pname</parameter></paramdef> | |
33 | <paramdef>GLfloat <parameter>param</parameter></paramdef> | |
34 | </funcprototype> | |
35 | </funcsynopsis> | |
36 | <funcsynopsis> | |
37 | <funcprototype> | |
38 | <funcdef>void <function>glTexGend</function></funcdef> | |
39 | <paramdef>GLenum <parameter>coord</parameter></paramdef> | |
40 | <paramdef>GLenum <parameter>pname</parameter></paramdef> | |
41 | <paramdef>GLdouble <parameter>param</parameter></paramdef> | |
42 | </funcprototype> | |
43 | </funcsynopsis> | |
44 | </refsynopsisdiv> | |
45 | <!-- eqn: ignoring delim $$ --> | |
46 | <refsect1 id="parameters"><title>Parameters</title> | |
47 | <variablelist> | |
48 | <varlistentry> | |
49 | <term><parameter>coord</parameter></term> | |
50 | <listitem> | |
51 | <para> | |
52 | Specifies a texture coordinate. | |
53 | Must be one of <constant>GL_S</constant>, <constant>GL_T</constant>, <constant>GL_R</constant>, or <constant>GL_Q</constant>. | |
54 | </para> | |
55 | </listitem> | |
56 | </varlistentry> | |
57 | <varlistentry> | |
58 | <term><parameter>pname</parameter></term> | |
59 | <listitem> | |
60 | <para> | |
61 | Specifies the symbolic name of the texture-coordinate generation function. | |
62 | Must be <constant>GL_TEXTURE_GEN_MODE</constant>. | |
63 | </para> | |
64 | </listitem> | |
65 | </varlistentry> | |
66 | <varlistentry> | |
67 | <term><parameter>param</parameter></term> | |
68 | <listitem> | |
69 | <para> | |
70 | Specifies a single-valued texture generation parameter, | |
71 | one of <constant>GL_OBJECT_LINEAR</constant>, <constant>GL_EYE_LINEAR</constant>, <constant>GL_SPHERE_MAP</constant>, | |
72 | <constant>GL_NORMAL_MAP</constant>, or <constant>GL_REFLECTION_MAP</constant>. | |
73 | </para> | |
74 | </listitem> | |
75 | </varlistentry> | |
76 | </variablelist> | |
77 | </refsect1> | |
78 | <refsynopsisdiv><title>C Specification</title> | |
79 | <funcsynopsis> | |
80 | <funcprototype> | |
81 | <funcdef>void <function>glTexGeniv</function></funcdef> | |
82 | <paramdef>GLenum <parameter>coord</parameter></paramdef> | |
83 | <paramdef>GLenum <parameter>pname</parameter></paramdef> | |
84 | <paramdef>const GLint * <parameter>params</parameter></paramdef> | |
85 | </funcprototype> | |
86 | </funcsynopsis> | |
87 | <funcsynopsis> | |
88 | <funcprototype> | |
89 | <funcdef>void <function>glTexGenfv</function></funcdef> | |
90 | <paramdef>GLenum <parameter>coord</parameter></paramdef> | |
91 | <paramdef>GLenum <parameter>pname</parameter></paramdef> | |
92 | <paramdef>const GLfloat * <parameter>params</parameter></paramdef> | |
93 | </funcprototype> | |
94 | </funcsynopsis> | |
95 | <funcsynopsis> | |
96 | <funcprototype> | |
97 | <funcdef>void <function>glTexGendv</function></funcdef> | |
98 | <paramdef>GLenum <parameter>coord</parameter></paramdef> | |
99 | <paramdef>GLenum <parameter>pname</parameter></paramdef> | |
100 | <paramdef>const GLdouble * <parameter>params</parameter></paramdef> | |
101 | </funcprototype> | |
102 | </funcsynopsis> | |
103 | </refsynopsisdiv> | |
104 | <refsect1 id="parameters2"><title>Parameters</title> | |
105 | <variablelist> | |
106 | <varlistentry> | |
107 | <term><parameter>coord</parameter></term> | |
108 | <listitem> | |
109 | <para> | |
110 | Specifies a texture coordinate. | |
111 | Must be one of <constant>GL_S</constant>, <constant>GL_T</constant>, <constant>GL_R</constant>, or <constant>GL_Q</constant>. | |
112 | </para> | |
113 | </listitem> | |
114 | </varlistentry> | |
115 | <varlistentry> | |
116 | <term><parameter>pname</parameter></term> | |
117 | <listitem> | |
118 | <para> | |
119 | Specifies the symbolic name of the texture-coordinate generation function | |
120 | or function parameters. | |
121 | Must be | |
122 | <constant>GL_TEXTURE_GEN_MODE</constant>, | |
123 | <constant>GL_OBJECT_PLANE</constant>, or | |
124 | <constant>GL_EYE_PLANE</constant>. | |
125 | </para> | |
126 | </listitem> | |
127 | </varlistentry> | |
128 | <varlistentry> | |
129 | <term><parameter>params</parameter></term> | |
130 | <listitem> | |
131 | <para> | |
132 | Specifies a pointer to an array of texture generation parameters. | |
133 | If <parameter>pname</parameter> is <constant>GL_TEXTURE_GEN_MODE</constant>, | |
134 | then the array must contain a single symbolic constant, | |
135 | one of | |
136 | <constant>GL_OBJECT_LINEAR</constant>, | |
137 | <constant>GL_EYE_LINEAR</constant>, | |
138 | <constant>GL_SPHERE_MAP</constant>, | |
139 | <constant>GL_NORMAL_MAP</constant>, or | |
140 | <constant>GL_REFLECTION_MAP</constant>. | |
141 | Otherwise, | |
142 | <parameter>params</parameter> holds the coefficients for the texture-coordinate generation function | |
143 | specified by <parameter>pname</parameter>. | |
144 | </para> | |
145 | </listitem> | |
146 | </varlistentry> | |
147 | </variablelist> | |
148 | </refsect1> | |
149 | <refsect1 id="description"><title>Description</title> | |
150 | <para> | |
151 | <function>glTexGen</function> selects a texture-coordinate generation function | |
152 | or supplies coefficients for one of the functions. | |
153 | <parameter>coord</parameter> names one of the (<emphasis>s</emphasis>, <emphasis>t</emphasis>, <emphasis>r</emphasis>, <emphasis>q</emphasis>) texture | |
154 | coordinates; it must be one of the symbols | |
155 | <constant>GL_S</constant>, | |
156 | <constant>GL_T</constant>, | |
157 | <constant>GL_R</constant>, or | |
158 | <constant>GL_Q</constant>. | |
159 | <parameter>pname</parameter> must be one of three symbolic constants: | |
160 | <constant>GL_TEXTURE_GEN_MODE</constant>, | |
161 | <constant>GL_OBJECT_PLANE</constant>, or | |
162 | <constant>GL_EYE_PLANE</constant>. | |
163 | If <parameter>pname</parameter> is <constant>GL_TEXTURE_GEN_MODE</constant>, | |
164 | then <parameter>params</parameter> chooses a mode, | |
165 | one of | |
166 | <constant>GL_OBJECT_LINEAR</constant>, | |
167 | <constant>GL_EYE_LINEAR</constant>, | |
168 | <constant>GL_SPHERE_MAP</constant>, | |
169 | <constant>GL_NORMAL_MAP</constant>, or | |
170 | <constant>GL_REFLECTION_MAP</constant>. | |
171 | If <parameter>pname</parameter> is either <constant>GL_OBJECT_PLANE</constant> or <constant>GL_EYE_PLANE</constant>, | |
172 | <parameter>params</parameter> contains coefficients for the corresponding | |
173 | texture generation function. | |
174 | </para> | |
175 | <para> | |
176 | If the texture generation function is <constant>GL_OBJECT_LINEAR</constant>, | |
177 | the function | |
178 | </para> | |
179 | <para> | |
180 | <inlineequation><mml:math> | |
181 | <!-- eqn: g = p sub 1 * x sub o + p sub 2 * y sub o + p sub 3 * z sub o + p sub 4 * w sub o:--> | |
182 | <mml:mrow> | |
183 | <mml:mi mathvariant="italic">g</mml:mi> | |
184 | <mml:mo>=</mml:mo> | |
185 | <mml:mrow> | |
186 | <mml:mrow> | |
187 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
188 | <mml:mn>1</mml:mn> | |
189 | </mml:msub> | |
190 | <mml:mo>×</mml:mo> | |
191 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
192 | <mml:mi mathvariant="italic">o</mml:mi> | |
193 | </mml:msub> | |
194 | </mml:mrow> | |
195 | <mml:mo>+</mml:mo> | |
196 | <mml:mrow> | |
197 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
198 | <mml:mn>2</mml:mn> | |
199 | </mml:msub> | |
200 | <mml:mo>×</mml:mo> | |
201 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
202 | <mml:mi mathvariant="italic">o</mml:mi> | |
203 | </mml:msub> | |
204 | </mml:mrow> | |
205 | <mml:mo>+</mml:mo> | |
206 | <mml:mrow> | |
207 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
208 | <mml:mn>3</mml:mn> | |
209 | </mml:msub> | |
210 | <mml:mo>×</mml:mo> | |
211 | <mml:msub><mml:mi mathvariant="italic">z</mml:mi> | |
212 | <mml:mi mathvariant="italic">o</mml:mi> | |
213 | </mml:msub> | |
214 | </mml:mrow> | |
215 | <mml:mo>+</mml:mo> | |
216 | <mml:mrow> | |
217 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
218 | <mml:mn>4</mml:mn> | |
219 | </mml:msub> | |
220 | <mml:mo>×</mml:mo> | |
221 | <mml:msub><mml:mi mathvariant="italic">w</mml:mi> | |
222 | <mml:mi mathvariant="italic">o</mml:mi> | |
223 | </mml:msub> | |
224 | </mml:mrow> | |
225 | </mml:mrow> | |
226 | </mml:mrow> | |
227 | </mml:math></inlineequation> | |
228 | </para> | |
229 | <para> | |
230 | is used, where | |
231 | <inlineequation><mml:math><mml:mi mathvariant="italic">g</mml:mi></mml:math></inlineequation> | |
232 | is the value computed for the coordinate named in <parameter>coord</parameter>, | |
233 | <inlineequation><mml:math> | |
234 | <!-- eqn: p sub 1:--> | |
235 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
236 | <mml:mn>1</mml:mn> | |
237 | </mml:msub> | |
238 | </mml:math></inlineequation>, | |
239 | <inlineequation><mml:math> | |
240 | <!-- eqn: p sub 2:--> | |
241 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
242 | <mml:mn>2</mml:mn> | |
243 | </mml:msub> | |
244 | </mml:math></inlineequation>, | |
245 | <inlineequation><mml:math> | |
246 | <!-- eqn: p sub 3:--> | |
247 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
248 | <mml:mn>3</mml:mn> | |
249 | </mml:msub> | |
250 | </mml:math></inlineequation>, | |
251 | and | |
252 | <inlineequation><mml:math> | |
253 | <!-- eqn: p sub 4:--> | |
254 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
255 | <mml:mn>4</mml:mn> | |
256 | </mml:msub> | |
257 | </mml:math></inlineequation> | |
258 | are the four values supplied in <parameter>params</parameter>, and | |
259 | <inlineequation><mml:math> | |
260 | <!-- eqn: x sub o:--> | |
261 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
262 | <mml:mi mathvariant="italic">o</mml:mi> | |
263 | </mml:msub> | |
264 | </mml:math></inlineequation>, | |
265 | <inlineequation><mml:math> | |
266 | <!-- eqn: y sub o:--> | |
267 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
268 | <mml:mi mathvariant="italic">o</mml:mi> | |
269 | </mml:msub> | |
270 | </mml:math></inlineequation>, | |
271 | <inlineequation><mml:math> | |
272 | <!-- eqn: z sub o:--> | |
273 | <mml:msub><mml:mi mathvariant="italic">z</mml:mi> | |
274 | <mml:mi mathvariant="italic">o</mml:mi> | |
275 | </mml:msub> | |
276 | </mml:math></inlineequation>, | |
277 | and | |
278 | <inlineequation><mml:math> | |
279 | <!-- eqn: w sub o:--> | |
280 | <mml:msub><mml:mi mathvariant="italic">w</mml:mi> | |
281 | <mml:mi mathvariant="italic">o</mml:mi> | |
282 | </mml:msub> | |
283 | </mml:math></inlineequation> | |
284 | are the object coordinates of the vertex. | |
285 | This function can be used, for example, to texture-map terrain using sea level | |
286 | as a reference plane | |
287 | (defined by | |
288 | <inlineequation><mml:math> | |
289 | <!-- eqn: p sub 1:--> | |
290 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
291 | <mml:mn>1</mml:mn> | |
292 | </mml:msub> | |
293 | </mml:math></inlineequation>, | |
294 | <inlineequation><mml:math> | |
295 | <!-- eqn: p sub 2:--> | |
296 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
297 | <mml:mn>2</mml:mn> | |
298 | </mml:msub> | |
299 | </mml:math></inlineequation>, | |
300 | <inlineequation><mml:math> | |
301 | <!-- eqn: p sub 3:--> | |
302 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
303 | <mml:mn>3</mml:mn> | |
304 | </mml:msub> | |
305 | </mml:math></inlineequation>, | |
306 | and | |
307 | <inlineequation><mml:math> | |
308 | <!-- eqn: p sub 4:--> | |
309 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
310 | <mml:mn>4</mml:mn> | |
311 | </mml:msub> | |
312 | </mml:math></inlineequation>). | |
313 | The altitude of a terrain vertex is computed by the <constant>GL_OBJECT_LINEAR</constant> | |
314 | coordinate generation function as its distance from sea level; | |
315 | that altitude can then be used to index the texture image to map white snow | |
316 | onto peaks and green grass onto foothills. | |
317 | </para> | |
318 | <para> | |
319 | If the texture generation function is <constant>GL_EYE_LINEAR</constant>, the function | |
320 | </para> | |
321 | <para> | |
322 | <informalequation><mml:math> | |
323 | <!-- eqn: g = {p sub 1} sup prime * x sub e + {p sub 2} sup prime * y sub e + {p sub 3} sup prime * z sub e + {p sub 4} sup prime * w sub e:--> | |
324 | <mml:mrow> | |
325 | <mml:mi mathvariant="italic">g</mml:mi> | |
326 | <mml:mo>=</mml:mo> | |
327 | <mml:mrow> | |
328 | <mml:mrow> | |
329 | <mml:msup><mml:mfenced open="" close=""> | |
330 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
331 | <mml:mn>1</mml:mn> | |
332 | </mml:msub> | |
333 | </mml:mfenced> | |
334 | <mml:mo>″</mml:mo> | |
335 | </mml:msup> | |
336 | <mml:mo>×</mml:mo> | |
337 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
338 | <mml:mi mathvariant="italic">e</mml:mi> | |
339 | </mml:msub> | |
340 | </mml:mrow> | |
341 | <mml:mo>+</mml:mo> | |
342 | <mml:mrow> | |
343 | <mml:msup><mml:mfenced open="" close=""> | |
344 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
345 | <mml:mn>2</mml:mn> | |
346 | </mml:msub> | |
347 | </mml:mfenced> | |
348 | <mml:mo>″</mml:mo> | |
349 | </mml:msup> | |
350 | <mml:mo>×</mml:mo> | |
351 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
352 | <mml:mi mathvariant="italic">e</mml:mi> | |
353 | </mml:msub> | |
354 | </mml:mrow> | |
355 | <mml:mo>+</mml:mo> | |
356 | <mml:mrow> | |
357 | <mml:msup><mml:mfenced open="" close=""> | |
358 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
359 | <mml:mn>3</mml:mn> | |
360 | </mml:msub> | |
361 | </mml:mfenced> | |
362 | <mml:mo>″</mml:mo> | |
363 | </mml:msup> | |
364 | <mml:mo>×</mml:mo> | |
365 | <mml:msub><mml:mi mathvariant="italic">z</mml:mi> | |
366 | <mml:mi mathvariant="italic">e</mml:mi> | |
367 | </mml:msub> | |
368 | </mml:mrow> | |
369 | <mml:mo>+</mml:mo> | |
370 | <mml:mrow> | |
371 | <mml:msup><mml:mfenced open="" close=""> | |
372 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
373 | <mml:mn>4</mml:mn> | |
374 | </mml:msub> | |
375 | </mml:mfenced> | |
376 | <mml:mo>″</mml:mo> | |
377 | </mml:msup> | |
378 | <mml:mo>×</mml:mo> | |
379 | <mml:msub><mml:mi mathvariant="italic">w</mml:mi> | |
380 | <mml:mi mathvariant="italic">e</mml:mi> | |
381 | </mml:msub> | |
382 | </mml:mrow> | |
383 | </mml:mrow> | |
384 | </mml:mrow> | |
385 | </mml:math></informalequation> | |
386 | </para> | |
387 | <para> | |
388 | is used, where | |
389 | </para> | |
390 | <para> | |
391 | <informalequation><mml:math> | |
392 | <!-- eqn: left ( {p sub 1} sup prime {p sub 2} sup prime {p sub 3} sup prime {p sub 4} sup prime right ) = left ( p sub 1 p sub 2 p sub 3 p sub 4 right ) M sup -1:--> | |
393 | <mml:mrow> | |
394 | <mml:mfenced open="(" close=")"> | |
395 | <mml:mrow> | |
396 | <mml:msup><mml:mfenced open="" close=""> | |
397 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
398 | <mml:mn>1</mml:mn> | |
399 | </mml:msub> | |
400 | </mml:mfenced> | |
401 | <mml:mo>″</mml:mo> | |
402 | </mml:msup> | |
403 | <mml:mo>⁢</mml:mo> | |
404 | <mml:msup><mml:mfenced open="" close=""> | |
405 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
406 | <mml:mn>2</mml:mn> | |
407 | </mml:msub> | |
408 | </mml:mfenced> | |
409 | <mml:mo>″</mml:mo> | |
410 | </mml:msup> | |
411 | <mml:mo>⁢</mml:mo> | |
412 | <mml:msup><mml:mfenced open="" close=""> | |
413 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
414 | <mml:mn>3</mml:mn> | |
415 | </mml:msub> | |
416 | </mml:mfenced> | |
417 | <mml:mo>″</mml:mo> | |
418 | </mml:msup> | |
419 | <mml:mo>⁢</mml:mo> | |
420 | <mml:msup><mml:mfenced open="" close=""> | |
421 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
422 | <mml:mn>4</mml:mn> | |
423 | </mml:msub> | |
424 | </mml:mfenced> | |
425 | <mml:mo>″</mml:mo> | |
426 | </mml:msup> | |
427 | </mml:mrow> | |
428 | </mml:mfenced> | |
429 | <mml:mo>=</mml:mo> | |
430 | <mml:mrow> | |
431 | <mml:mfenced open="(" close=")"> | |
432 | <mml:mrow> | |
433 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
434 | <mml:mn>1</mml:mn> | |
435 | </mml:msub> | |
436 | <mml:mo>⁢</mml:mo> | |
437 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
438 | <mml:mn>2</mml:mn> | |
439 | </mml:msub> | |
440 | <mml:mo>⁢</mml:mo> | |
441 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
442 | <mml:mn>3</mml:mn> | |
443 | </mml:msub> | |
444 | <mml:mo>⁢</mml:mo> | |
445 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
446 | <mml:mn>4</mml:mn> | |
447 | </mml:msub> | |
448 | </mml:mrow> | |
449 | </mml:mfenced> | |
450 | <mml:mo>⁢</mml:mo> | |
451 | <mml:msup><mml:mi mathvariant="italic">M</mml:mi> | |
452 | <mml:mn>-1</mml:mn> | |
453 | </mml:msup> | |
454 | </mml:mrow> | |
455 | </mml:mrow> | |
456 | </mml:math></informalequation> | |
457 | </para> | |
458 | <para> | |
459 | and | |
460 | <inlineequation><mml:math> | |
461 | <!-- eqn: x sub e:--> | |
462 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
463 | <mml:mi mathvariant="italic">e</mml:mi> | |
464 | </mml:msub> | |
465 | </mml:math></inlineequation>, | |
466 | <inlineequation><mml:math> | |
467 | <!-- eqn: y sub e:--> | |
468 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
469 | <mml:mi mathvariant="italic">e</mml:mi> | |
470 | </mml:msub> | |
471 | </mml:math></inlineequation>, | |
472 | <inlineequation><mml:math> | |
473 | <!-- eqn: z sub e:--> | |
474 | <mml:msub><mml:mi mathvariant="italic">z</mml:mi> | |
475 | <mml:mi mathvariant="italic">e</mml:mi> | |
476 | </mml:msub> | |
477 | </mml:math></inlineequation>, | |
478 | and | |
479 | <inlineequation><mml:math> | |
480 | <!-- eqn: w sub e:--> | |
481 | <mml:msub><mml:mi mathvariant="italic">w</mml:mi> | |
482 | <mml:mi mathvariant="italic">e</mml:mi> | |
483 | </mml:msub> | |
484 | </mml:math></inlineequation> | |
485 | are the eye coordinates of the vertex, | |
486 | <inlineequation><mml:math> | |
487 | <!-- eqn: p sub 1:--> | |
488 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
489 | <mml:mn>1</mml:mn> | |
490 | </mml:msub> | |
491 | </mml:math></inlineequation>, | |
492 | <inlineequation><mml:math> | |
493 | <!-- eqn: p sub 2:--> | |
494 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
495 | <mml:mn>2</mml:mn> | |
496 | </mml:msub> | |
497 | </mml:math></inlineequation>, | |
498 | <inlineequation><mml:math> | |
499 | <!-- eqn: p sub 3:--> | |
500 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
501 | <mml:mn>3</mml:mn> | |
502 | </mml:msub> | |
503 | </mml:math></inlineequation>, | |
504 | and | |
505 | <inlineequation><mml:math> | |
506 | <!-- eqn: p sub 4:--> | |
507 | <mml:msub><mml:mi mathvariant="italic">p</mml:mi> | |
508 | <mml:mn>4</mml:mn> | |
509 | </mml:msub> | |
510 | </mml:math></inlineequation> | |
511 | are the values supplied in <parameter>params</parameter>, and | |
512 | <inlineequation><mml:math><mml:mi mathvariant="italic">M</mml:mi></mml:math></inlineequation> | |
513 | is the modelview matrix when <function>glTexGen</function> is invoked. | |
514 | If | |
515 | <inlineequation><mml:math><mml:mi mathvariant="italic">M</mml:mi></mml:math></inlineequation> | |
516 | is poorly conditioned or singular, | |
517 | texture coordinates generated by the resulting function may be inaccurate | |
518 | or undefined. | |
519 | </para> | |
520 | <para> | |
521 | Note that the values in <parameter>params</parameter> define a reference plane in eye coordinates. | |
522 | The modelview matrix that is applied to them may not be the same one | |
523 | in effect when the polygon vertices are transformed. | |
524 | This function establishes a field of texture coordinates | |
525 | that can produce dynamic contour lines on moving objects. | |
526 | </para> | |
527 | <para> | |
528 | If the texture generation function is <constant>GL_SPHERE_MAP</constant> and <parameter>coord</parameter> is either | |
529 | <constant>GL_S</constant> or | |
530 | <constant>GL_T</constant>, | |
531 | <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation> | |
532 | and | |
533 | <inlineequation><mml:math><mml:mi mathvariant="italic">t</mml:mi></mml:math></inlineequation> | |
534 | texture coordinates are generated as follows. | |
535 | Let <emphasis>u</emphasis> be the unit vector pointing from the origin to the polygon vertex | |
536 | (in eye coordinates). | |
537 | Let <emphasis>n</emphasis> sup prime be the current normal, | |
538 | after transformation to eye coordinates. | |
539 | Let | |
540 | </para> | |
541 | <para> | |
542 | <inlineequation><mml:math> | |
543 | <!-- eqn: f = ( f sub x f sub y f sub z ) sup T:--> | |
544 | <mml:mrow> | |
545 | <mml:mi mathvariant="italic">f</mml:mi> | |
546 | <mml:mo>=</mml:mo> | |
547 | <mml:msup><mml:mfenced open="(" close=")"> | |
548 | <mml:mrow> | |
549 | <mml:msub><mml:mi mathvariant="italic">f</mml:mi> | |
550 | <mml:mi mathvariant="italic">x</mml:mi> | |
551 | </mml:msub> | |
552 | <mml:mo>⁢</mml:mo> | |
553 | <mml:msub><mml:mi mathvariant="italic">f</mml:mi> | |
554 | <mml:mi mathvariant="italic">y</mml:mi> | |
555 | </mml:msub> | |
556 | <mml:mo>⁢</mml:mo> | |
557 | <mml:msub><mml:mi mathvariant="italic">f</mml:mi> | |
558 | <mml:mi mathvariant="italic">z</mml:mi> | |
559 | </mml:msub> | |
560 | </mml:mrow> | |
561 | </mml:mfenced> | |
562 | <mml:mi mathvariant="italic">T</mml:mi> | |
563 | </mml:msup> | |
564 | </mml:mrow> | |
565 | </mml:math></inlineequation> | |
566 | be the reflection vector such that | |
567 | </para> | |
568 | <para> | |
569 | <inlineequation><mml:math> | |
570 | <!-- eqn: f = u - 2 n sup prime {n sup prime} sup T u:--> | |
571 | <mml:mrow> | |
572 | <mml:mi mathvariant="italic">f</mml:mi> | |
573 | <mml:mo>=</mml:mo> | |
574 | <mml:mrow> | |
575 | <mml:mi mathvariant="italic">u</mml:mi> | |
576 | <mml:mo>-</mml:mo> | |
577 | <mml:mn>2</mml:mn> | |
578 | <mml:mo>⁢</mml:mo> | |
579 | <mml:msup><mml:mi mathvariant="italic">n</mml:mi> | |
580 | <mml:mo>″</mml:mo> | |
581 | </mml:msup> | |
582 | <mml:mo>⁢</mml:mo> | |
583 | <mml:msup><mml:mfenced open="" close=""> | |
584 | <mml:msup><mml:mi mathvariant="italic">n</mml:mi> | |
585 | <mml:mo>″</mml:mo> | |
586 | </mml:msup> | |
587 | </mml:mfenced> | |
588 | <mml:mi mathvariant="italic">T</mml:mi> | |
589 | </mml:msup> | |
590 | <mml:mo>⁢</mml:mo> | |
591 | <mml:mi mathvariant="italic">u</mml:mi> | |
592 | </mml:mrow> | |
593 | </mml:mrow> | |
594 | </mml:math></inlineequation> | |
595 | </para> | |
596 | <para> | |
597 | Finally, let | |
598 | <inlineequation><mml:math> | |
599 | <!-- eqn: m = 2 sqrt ({f sub x} sup 2 + {f sub y} sup 2 + (f sub z + 1) sup 2):--> | |
600 | <mml:mrow> | |
601 | <mml:mi mathvariant="italic">m</mml:mi> | |
602 | <mml:mo>=</mml:mo> | |
603 | <mml:mrow> | |
604 | <mml:mn>2</mml:mn> | |
605 | <mml:mo>⁢</mml:mo> | |
606 | <mml:msqrt> | |
607 | <mml:mfenced open="(" close=")"> | |
608 | <mml:mrow> | |
609 | <mml:msup><mml:mfenced open="" close=""> | |
610 | <mml:msub><mml:mi mathvariant="italic">f</mml:mi> | |
611 | <mml:mi mathvariant="italic">x</mml:mi> | |
612 | </mml:msub> | |
613 | </mml:mfenced> | |
614 | <mml:mn>2</mml:mn> | |
615 | </mml:msup> | |
616 | <mml:mo>+</mml:mo> | |
617 | <mml:msup><mml:mfenced open="" close=""> | |
618 | <mml:msub><mml:mi mathvariant="italic">f</mml:mi> | |
619 | <mml:mi mathvariant="italic">y</mml:mi> | |
620 | </mml:msub> | |
621 | </mml:mfenced> | |
622 | <mml:mn>2</mml:mn> | |
623 | </mml:msup> | |
624 | <mml:mo>+</mml:mo> | |
625 | <mml:msup><mml:mfenced open="(" close=")"> | |
626 | <mml:mrow> | |
627 | <mml:msub><mml:mi mathvariant="italic">f</mml:mi> | |
628 | <mml:mi mathvariant="italic">z</mml:mi> | |
629 | </mml:msub> | |
630 | <mml:mo>+</mml:mo> | |
631 | <mml:mn>1</mml:mn> | |
632 | </mml:mrow> | |
633 | </mml:mfenced> | |
634 | <mml:mn>2</mml:mn> | |
635 | </mml:msup> | |
636 | </mml:mrow> | |
637 | </mml:mfenced> | |
638 | </mml:msqrt> | |
639 | </mml:mrow> | |
640 | </mml:mrow> | |
641 | </mml:math></inlineequation>. | |
642 | Then the values assigned to the | |
643 | <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation> | |
644 | and | |
645 | <inlineequation><mml:math><mml:mi mathvariant="italic">t</mml:mi></mml:math></inlineequation> | |
646 | texture coordinates are | |
647 | </para> | |
648 | <para> | |
649 | <inlineequation><mml:math> | |
650 | <!-- eqn: s = f sub x over m + 1 over 2:--> | |
651 | <mml:mrow> | |
652 | <mml:mi mathvariant="italic">s</mml:mi> | |
653 | <mml:mo>=</mml:mo> | |
654 | <mml:mrow> | |
655 | <mml:mfrac> | |
656 | <mml:msub><mml:mi mathvariant="italic">f</mml:mi> | |
657 | <mml:mi mathvariant="italic">x</mml:mi> | |
658 | </mml:msub> | |
659 | <mml:mi mathvariant="italic">m</mml:mi> | |
660 | </mml:mfrac> | |
661 | <mml:mo>+</mml:mo> | |
662 | <mml:mfrac> | |
663 | <mml:mn>1</mml:mn> | |
664 | <mml:mn>2</mml:mn> | |
665 | </mml:mfrac> | |
666 | </mml:mrow> | |
667 | </mml:mrow> | |
668 | </mml:math></inlineequation> | |
669 | </para> | |
670 | <para> | |
671 | <inlineequation><mml:math> | |
672 | <!-- eqn: t = f sub y over m + 1 over 2:--> | |
673 | <mml:mrow> | |
674 | <mml:mi mathvariant="italic">t</mml:mi> | |
675 | <mml:mo>=</mml:mo> | |
676 | <mml:mrow> | |
677 | <mml:mfrac> | |
678 | <mml:msub><mml:mi mathvariant="italic">f</mml:mi> | |
679 | <mml:mi mathvariant="italic">y</mml:mi> | |
680 | </mml:msub> | |
681 | <mml:mi mathvariant="italic">m</mml:mi> | |
682 | </mml:mfrac> | |
683 | <mml:mo>+</mml:mo> | |
684 | <mml:mfrac> | |
685 | <mml:mn>1</mml:mn> | |
686 | <mml:mn>2</mml:mn> | |
687 | </mml:mfrac> | |
688 | </mml:mrow> | |
689 | </mml:mrow> | |
690 | </mml:math></inlineequation> | |
691 | </para> | |
692 | <para> | |
693 | To enable or disable a texture-coordinate generation function, call | |
694 | <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry> or <citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry> | |
695 | with one of the symbolic texture-coordinate names | |
696 | (<constant>GL_TEXTURE_GEN_S</constant>, | |
697 | <constant>GL_TEXTURE_GEN_T</constant>, | |
698 | <constant>GL_TEXTURE_GEN_R</constant>, or | |
699 | <constant>GL_TEXTURE_GEN_Q</constant>) as the argument. | |
700 | When enabled, | |
701 | the specified texture coordinate is computed | |
702 | according to the generating function associated with that coordinate. | |
703 | When disabled, | |
704 | subsequent vertices take the specified texture coordinate | |
705 | from the current set of texture coordinates. Initially, all texture | |
706 | generation functions are set to <constant>GL_EYE_LINEAR</constant> and are disabled. | |
707 | Both | |
708 | <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation> | |
709 | plane equations are (1, 0, 0, 0), | |
710 | both | |
711 | <inlineequation><mml:math><mml:mi mathvariant="italic">t</mml:mi></mml:math></inlineequation> | |
712 | plane equations are (0, 1, 0, 0), | |
713 | and all | |
714 | <inlineequation><mml:math><mml:mi mathvariant="italic">r</mml:mi></mml:math></inlineequation> | |
715 | and | |
716 | <inlineequation><mml:math><mml:mi mathvariant="italic">q</mml:mi></mml:math></inlineequation> | |
717 | plane equations are (0, 0, 0, 0). | |
718 | </para> | |
719 | <para> | |
720 | When the <code>ARB_multitexture</code> extension is supported, <function>glTexGen</function> sets the | |
721 | texture generation parameters for the currently active texture unit, | |
722 | selected with <citerefentry><refentrytitle>glActiveTexture</refentrytitle></citerefentry>. | |
723 | </para> | |
724 | </refsect1> | |
725 | <refsect1 id="errors"><title>Errors</title> | |
726 | <para> | |
727 | <constant>GL_INVALID_ENUM</constant> is generated when <parameter>coord</parameter> or <parameter>pname</parameter> is not an | |
728 | accepted defined value, | |
729 | or when <parameter>pname</parameter> is <constant>GL_TEXTURE_GEN_MODE</constant> and <parameter>params</parameter> is not an | |
730 | accepted defined value. | |
731 | </para> | |
732 | <para> | |
733 | <constant>GL_INVALID_ENUM</constant> is generated when <parameter>pname</parameter> is <constant>GL_TEXTURE_GEN_MODE</constant>, | |
734 | <parameter>params</parameter> is <constant>GL_SPHERE_MAP</constant>, | |
735 | and <parameter>coord</parameter> is either <constant>GL_R</constant> or <constant>GL_Q</constant>. | |
736 | </para> | |
737 | <para> | |
738 | <constant>GL_INVALID_OPERATION</constant> is generated if <function>glTexGen</function> | |
739 | is executed between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> | |
740 | and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>. | |
741 | </para> | |
742 | </refsect1> | |
743 | <refsect1 id="associatedgets"><title>Associated Gets</title> | |
744 | <para> | |
745 | <citerefentry><refentrytitle>glGetTexGen</refentrytitle></citerefentry> | |
746 | </para> | |
747 | <para> | |
748 | <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_GEN_S</constant> | |
749 | </para> | |
750 | <para> | |
751 | <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_GEN_T</constant> | |
752 | </para> | |
753 | <para> | |
754 | <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_GEN_R</constant> | |
755 | </para> | |
756 | <para> | |
757 | <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_GEN_Q</constant> | |
758 | </para> | |
759 | </refsect1> | |
760 | <refsect1 id="seealso"><title>See Also</title> | |
761 | <para> | |
762 | <citerefentry><refentrytitle>glActiveTexture</refentrytitle></citerefentry>, | |
763 | <citerefentry><refentrytitle>glCopyPixels</refentrytitle></citerefentry>, | |
764 | <citerefentry><refentrytitle>glCopyTexImage2D</refentrytitle></citerefentry>, | |
765 | <citerefentry><refentrytitle>glCopyTexSubImage1D</refentrytitle></citerefentry>, | |
766 | <citerefentry><refentrytitle>glCopyTexSubImage2D</refentrytitle></citerefentry>, | |
767 | <citerefentry><refentrytitle>glCopyTexSubImage3D</refentrytitle></citerefentry>, | |
768 | <citerefentry><refentrytitle>glTexEnv</refentrytitle></citerefentry>, | |
769 | <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>, | |
770 | <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>, | |
771 | <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>, | |
772 | <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry>, | |
773 | <citerefentry><refentrytitle>glTexSubImage1D</refentrytitle></citerefentry>, | |
774 | <citerefentry><refentrytitle>glTexSubImage2D</refentrytitle></citerefentry>, | |
775 | <citerefentry><refentrytitle>glTexSubImage3D</refentrytitle></citerefentry> | |
776 | </para> | |
777 | </refsect1> | |
778 | <refsect1 id="Copyright"><title>Copyright</title> | |
779 | <para> | |
780 | Copyright <trademark class="copyright"></trademark> 1991-2006 | |
781 | Silicon Graphics, Inc. This document is licensed under the SGI | |
782 | Free Software B License. For details, see | |
783 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. | |
784 | </para> | |
785 | </refsect1> | |
786 | </refentry> |