rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man2 / xhtml / glTexGen.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
3 <!-- saved from url=(0013)about:internet -->
4 <?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>glTexGen</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glTexGen"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glTexGen — control the generation of texture 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">void <b class="fsfunc">glTexGeni</b>(</code></td><td>GLenum  </td><td><var class="pdparam">coord</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">param</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexGenf</b>(</code></td><td>GLenum  </td><td><var class="pdparam">coord</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLfloat  </td><td><var class="pdparam">param</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexGend</b>(</code></td><td>GLenum  </td><td><var class="pdparam">coord</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLdouble  </td><td><var class="pdparam">param</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>coord</code></em></span></dt><dd><p>
5 Specifies a texture coordinate.
6 Must be one of <code class="constant">GL_S</code>, <code class="constant">GL_T</code>, <code class="constant">GL_R</code>, or <code class="constant">GL_Q</code>.
7 </p></dd><dt><span class="term"><em class="parameter"><code>pname</code></em></span></dt><dd><p>
8 Specifies the symbolic name of the texture-coordinate generation function.
9 Must be <code class="constant">GL_TEXTURE_GEN_MODE</code>.
10 </p></dd><dt><span class="term"><em class="parameter"><code>param</code></em></span></dt><dd><p>
11 Specifies a single-valued texture generation parameter,
12 one of <code class="constant">GL_OBJECT_LINEAR</code>, <code class="constant">GL_EYE_LINEAR</code>, <code class="constant">GL_SPHERE_MAP</code>,
13 <code class="constant">GL_NORMAL_MAP</code>, or <code class="constant">GL_REFLECTION_MAP</code>.
14 </p></dd></dl></div></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">glTexGeniv</b>(</code></td><td>GLenum  </td><td><var class="pdparam">coord</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLint *  </td><td><var class="pdparam">params</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexGenfv</b>(</code></td><td>GLenum  </td><td><var class="pdparam">coord</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLfloat *  </td><td><var class="pdparam">params</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexGendv</b>(</code></td><td>GLenum  </td><td><var class="pdparam">coord</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLdouble *  </td><td><var class="pdparam">params</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters2"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>coord</code></em></span></dt><dd><p>
15 Specifies a texture coordinate.
16 Must be one of <code class="constant">GL_S</code>, <code class="constant">GL_T</code>, <code class="constant">GL_R</code>, or <code class="constant">GL_Q</code>.
17 </p></dd><dt><span class="term"><em class="parameter"><code>pname</code></em></span></dt><dd><p>
18 Specifies the symbolic name of the texture-coordinate generation function
19 or function parameters.
20 Must be
21 <code class="constant">GL_TEXTURE_GEN_MODE</code>,
22 <code class="constant">GL_OBJECT_PLANE</code>, or
23 <code class="constant">GL_EYE_PLANE</code>.
24 </p></dd><dt><span class="term"><em class="parameter"><code>params</code></em></span></dt><dd><p>
25 Specifies a pointer to an array of texture generation parameters.
26 If <em class="parameter"><code>pname</code></em> is <code class="constant">GL_TEXTURE_GEN_MODE</code>,
27 then the array must contain a single symbolic constant,
28 one of
29 <code class="constant">GL_OBJECT_LINEAR</code>,
30 <code class="constant">GL_EYE_LINEAR</code>,
31 <code class="constant">GL_SPHERE_MAP</code>,
32 <code class="constant">GL_NORMAL_MAP</code>, or
33 <code class="constant">GL_REFLECTION_MAP</code>.
34 Otherwise,
35 <em class="parameter"><code>params</code></em> holds the coefficients for the texture-coordinate generation function
36 specified by <em class="parameter"><code>pname</code></em>.
37 </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
38 <code class="function">glTexGen</code> selects a texture-coordinate generation function
39 or supplies coefficients for one of the functions.
40 <em class="parameter"><code>coord</code></em> names one of the (<span class="emphasis"><em>s</em></span>, <span class="emphasis"><em>t</em></span>, <span class="emphasis"><em>r</em></span>, <span class="emphasis"><em>q</em></span>) texture
41 coordinates; it must be one of the symbols
42 <code class="constant">GL_S</code>,
43 <code class="constant">GL_T</code>,
44 <code class="constant">GL_R</code>, or
45 <code class="constant">GL_Q</code>.
46 <em class="parameter"><code>pname</code></em> must be one of three symbolic constants:
47 <code class="constant">GL_TEXTURE_GEN_MODE</code>,
48 <code class="constant">GL_OBJECT_PLANE</code>, or
49 <code class="constant">GL_EYE_PLANE</code>.
50 If <em class="parameter"><code>pname</code></em> is <code class="constant">GL_TEXTURE_GEN_MODE</code>,
51 then <em class="parameter"><code>params</code></em> chooses a mode,
52 one of
53 <code class="constant">GL_OBJECT_LINEAR</code>,
54 <code class="constant">GL_EYE_LINEAR</code>,
55 <code class="constant">GL_SPHERE_MAP</code>,
56 <code class="constant">GL_NORMAL_MAP</code>, or
57 <code class="constant">GL_REFLECTION_MAP</code>.
58 If <em class="parameter"><code>pname</code></em> is either <code class="constant">GL_OBJECT_PLANE</code> or <code class="constant">GL_EYE_PLANE</code>,
59 <em class="parameter"><code>params</code></em> contains coefficients for the corresponding
60 texture generation function.
61 </p><p>
62 If the texture generation function is <code class="constant">GL_OBJECT_LINEAR</code>,
63 the function
64 </p><p>
65 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
66
67 <mml:mrow>
68 <mml:mi mathvariant="italic">g</mml:mi>
69 <mml:mo>=</mml:mo>
70 <mml:mrow>
71 <mml:mrow>
72 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
73 <mml:mn>1</mml:mn>
74 </mml:msub>
75 <mml:mo>×</mml:mo>
76 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
77 <mml:mi mathvariant="italic">o</mml:mi>
78 </mml:msub>
79 </mml:mrow>
80 <mml:mo>+</mml:mo>
81 <mml:mrow>
82 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
83 <mml:mn>2</mml:mn>
84 </mml:msub>
85 <mml:mo>×</mml:mo>
86 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
87 <mml:mi mathvariant="italic">o</mml:mi>
88 </mml:msub>
89 </mml:mrow>
90 <mml:mo>+</mml:mo>
91 <mml:mrow>
92 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
93 <mml:mn>3</mml:mn>
94 </mml:msub>
95 <mml:mo>×</mml:mo>
96 <mml:msub><mml:mi mathvariant="italic">z</mml:mi>
97 <mml:mi mathvariant="italic">o</mml:mi>
98 </mml:msub>
99 </mml:mrow>
100 <mml:mo>+</mml:mo>
101 <mml:mrow>
102 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
103 <mml:mn>4</mml:mn>
104 </mml:msub>
105 <mml:mo>×</mml:mo>
106 <mml:msub><mml:mi mathvariant="italic">w</mml:mi>
107 <mml:mi mathvariant="italic">o</mml:mi>
108 </mml:msub>
109 </mml:mrow>
110 </mml:mrow>
111 </mml:mrow>
112 </mml:math>
113 </p><p>
114 is used, where
115 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">g</mml:mi></mml:math>
116 is the value computed for the coordinate named in <em class="parameter"><code>coord</code></em>,
117 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
118
119 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
120 <mml:mn>1</mml:mn>
121 </mml:msub>
122 </mml:math>,
123 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
124
125 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
126 <mml:mn>2</mml:mn>
127 </mml:msub>
128 </mml:math>,
129 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
130
131 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
132 <mml:mn>3</mml:mn>
133 </mml:msub>
134 </mml:math>,
135 and
136 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
137
138 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
139 <mml:mn>4</mml:mn>
140 </mml:msub>
141 </mml:math>
142 are the four values supplied in <em class="parameter"><code>params</code></em>, and
143 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
144
145 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
146 <mml:mi mathvariant="italic">o</mml:mi>
147 </mml:msub>
148 </mml:math>,
149 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
150
151 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
152 <mml:mi mathvariant="italic">o</mml:mi>
153 </mml:msub>
154 </mml:math>,
155 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
156
157 <mml:msub><mml:mi mathvariant="italic">z</mml:mi>
158 <mml:mi mathvariant="italic">o</mml:mi>
159 </mml:msub>
160 </mml:math>,
161 and
162 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
163
164 <mml:msub><mml:mi mathvariant="italic">w</mml:mi>
165 <mml:mi mathvariant="italic">o</mml:mi>
166 </mml:msub>
167 </mml:math>
168 are the object coordinates of the vertex.
169 This function can be used, for example, to texture-map terrain using sea level
170 as a reference plane
171 (defined by
172 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
173
174 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
175 <mml:mn>1</mml:mn>
176 </mml:msub>
177 </mml:math>,
178 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
179
180 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
181 <mml:mn>2</mml:mn>
182 </mml:msub>
183 </mml:math>,
184 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
185
186 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
187 <mml:mn>3</mml:mn>
188 </mml:msub>
189 </mml:math>,
190 and
191 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
192
193 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
194 <mml:mn>4</mml:mn>
195 </mml:msub>
196 </mml:math>).
197 The altitude of a terrain vertex is computed by the <code class="constant">GL_OBJECT_LINEAR</code>
198 coordinate generation function as its distance from sea level;
199 that altitude can then be used to index the texture image to map white snow
200 onto peaks and green grass onto foothills.
201 </p><p>
202 If the texture generation function is <code class="constant">GL_EYE_LINEAR</code>, the function
203 </p><p>
204 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
205
206 <mml:mrow>
207 <mml:mi mathvariant="italic">g</mml:mi>
208 <mml:mo>=</mml:mo>
209 <mml:mrow>
210 <mml:mrow>
211 <mml:msup><mml:mfenced open="" close="">
212 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
213 <mml:mn>1</mml:mn>
214 </mml:msub>
215 </mml:mfenced>
216 <mml:mo></mml:mo>
217 </mml:msup>
218 <mml:mo>×</mml:mo>
219 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
220 <mml:mi mathvariant="italic">e</mml:mi>
221 </mml:msub>
222 </mml:mrow>
223 <mml:mo>+</mml:mo>
224 <mml:mrow>
225 <mml:msup><mml:mfenced open="" close="">
226 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
227 <mml:mn>2</mml:mn>
228 </mml:msub>
229 </mml:mfenced>
230 <mml:mo></mml:mo>
231 </mml:msup>
232 <mml:mo>×</mml:mo>
233 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
234 <mml:mi mathvariant="italic">e</mml:mi>
235 </mml:msub>
236 </mml:mrow>
237 <mml:mo>+</mml:mo>
238 <mml:mrow>
239 <mml:msup><mml:mfenced open="" close="">
240 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
241 <mml:mn>3</mml:mn>
242 </mml:msub>
243 </mml:mfenced>
244 <mml:mo></mml:mo>
245 </mml:msup>
246 <mml:mo>×</mml:mo>
247 <mml:msub><mml:mi mathvariant="italic">z</mml:mi>
248 <mml:mi mathvariant="italic">e</mml:mi>
249 </mml:msub>
250 </mml:mrow>
251 <mml:mo>+</mml:mo>
252 <mml:mrow>
253 <mml:msup><mml:mfenced open="" close="">
254 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
255 <mml:mn>4</mml:mn>
256 </mml:msub>
257 </mml:mfenced>
258 <mml:mo></mml:mo>
259 </mml:msup>
260 <mml:mo>×</mml:mo>
261 <mml:msub><mml:mi mathvariant="italic">w</mml:mi>
262 <mml:mi mathvariant="italic">e</mml:mi>
263 </mml:msub>
264 </mml:mrow>
265 </mml:mrow>
266 </mml:mrow>
267 </mml:math></div><p>
268 </p><p>
269 is used, where
270 </p><p>
271 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
272
273 <mml:mrow>
274 <mml:mfenced open="(" close=")">
275 <mml:mrow>
276 <mml:msup><mml:mfenced open="" close="">
277 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
278 <mml:mn>1</mml:mn>
279 </mml:msub>
280 </mml:mfenced>
281 <mml:mo></mml:mo>
282 </mml:msup>
283 <mml:mo></mml:mo>
284 <mml:msup><mml:mfenced open="" close="">
285 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
286 <mml:mn>2</mml:mn>
287 </mml:msub>
288 </mml:mfenced>
289 <mml:mo></mml:mo>
290 </mml:msup>
291 <mml:mo></mml:mo>
292 <mml:msup><mml:mfenced open="" close="">
293 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
294 <mml:mn>3</mml:mn>
295 </mml:msub>
296 </mml:mfenced>
297 <mml:mo></mml:mo>
298 </mml:msup>
299 <mml:mo></mml:mo>
300 <mml:msup><mml:mfenced open="" close="">
301 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
302 <mml:mn>4</mml:mn>
303 </mml:msub>
304 </mml:mfenced>
305 <mml:mo></mml:mo>
306 </mml:msup>
307 </mml:mrow>
308 </mml:mfenced>
309 <mml:mo>=</mml:mo>
310 <mml:mrow>
311 <mml:mfenced open="(" close=")">
312 <mml:mrow>
313 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
314 <mml:mn>1</mml:mn>
315 </mml:msub>
316 <mml:mo></mml:mo>
317 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
318 <mml:mn>2</mml:mn>
319 </mml:msub>
320 <mml:mo></mml:mo>
321 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
322 <mml:mn>3</mml:mn>
323 </mml:msub>
324 <mml:mo></mml:mo>
325 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
326 <mml:mn>4</mml:mn>
327 </mml:msub>
328 </mml:mrow>
329 </mml:mfenced>
330 <mml:mo></mml:mo>
331 <mml:msup><mml:mi mathvariant="italic">M</mml:mi>
332 <mml:mn>-1</mml:mn>
333 </mml:msup>
334 </mml:mrow>
335 </mml:mrow>
336 </mml:math></div><p>
337 </p><p>
338 and
339 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
340
341 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
342 <mml:mi mathvariant="italic">e</mml:mi>
343 </mml:msub>
344 </mml:math>,
345 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
346
347 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
348 <mml:mi mathvariant="italic">e</mml:mi>
349 </mml:msub>
350 </mml:math>,
351 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
352
353 <mml:msub><mml:mi mathvariant="italic">z</mml:mi>
354 <mml:mi mathvariant="italic">e</mml:mi>
355 </mml:msub>
356 </mml:math>,
357 and
358 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
359
360 <mml:msub><mml:mi mathvariant="italic">w</mml:mi>
361 <mml:mi mathvariant="italic">e</mml:mi>
362 </mml:msub>
363 </mml:math>
364 are the eye coordinates of the vertex,
365 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
366
367 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
368 <mml:mn>1</mml:mn>
369 </mml:msub>
370 </mml:math>,
371 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
372
373 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
374 <mml:mn>2</mml:mn>
375 </mml:msub>
376 </mml:math>,
377 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
378
379 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
380 <mml:mn>3</mml:mn>
381 </mml:msub>
382 </mml:math>,
383 and
384 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
385
386 <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
387 <mml:mn>4</mml:mn>
388 </mml:msub>
389 </mml:math>
390 are the values supplied in <em class="parameter"><code>params</code></em>, and
391 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">M</mml:mi></mml:math>
392 is the modelview matrix when <code class="function">glTexGen</code> is invoked.
393 If
394 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">M</mml:mi></mml:math>
395 is poorly conditioned or singular,
396 texture coordinates generated by the resulting function may be inaccurate
397 or undefined.
398 </p><p>
399 Note that the values in <em class="parameter"><code>params</code></em> define a reference plane in eye coordinates.
400 The modelview matrix that is applied to them may not be the same one
401 in effect when the polygon vertices are transformed.
402 This function establishes a field of texture coordinates
403 that can produce dynamic contour lines on moving objects.
404 </p><p>
405 If the texture generation function is <code class="constant">GL_SPHERE_MAP</code> and <em class="parameter"><code>coord</code></em> is either
406 <code class="constant">GL_S</code> or
407 <code class="constant">GL_T</code>,
408 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math>
409 and
410 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">t</mml:mi></mml:math>
411 texture coordinates are generated as follows.
412 Let <span class="emphasis"><em>u</em></span> be the unit vector pointing from the origin to the polygon vertex
413 (in eye coordinates).
414 Let <span class="emphasis"><em>n</em></span> sup prime be the current normal,
415 after transformation to eye coordinates.
416 Let
417 </p><p>
418 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
419
420 <mml:mrow>
421 <mml:mi mathvariant="italic">f</mml:mi>
422 <mml:mo>=</mml:mo>
423 <mml:msup><mml:mfenced open="(" close=")">
424 <mml:mrow>
425 <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
426 <mml:mi mathvariant="italic">x</mml:mi>
427 </mml:msub>
428 <mml:mo></mml:mo>
429 <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
430 <mml:mi mathvariant="italic">y</mml:mi>
431 </mml:msub>
432 <mml:mo></mml:mo>
433 <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
434 <mml:mi mathvariant="italic">z</mml:mi>
435 </mml:msub>
436 </mml:mrow>
437 </mml:mfenced>
438 <mml:mi mathvariant="italic">T</mml:mi>
439 </mml:msup>
440 </mml:mrow>
441 </mml:math>
442 be the reflection vector such that
443 </p><p>
444 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
445
446 <mml:mrow>
447 <mml:mi mathvariant="italic">f</mml:mi>
448 <mml:mo>=</mml:mo>
449 <mml:mrow>
450 <mml:mi mathvariant="italic">u</mml:mi>
451 <mml:mo>-</mml:mo>
452 <mml:mn>2</mml:mn>
453 <mml:mo></mml:mo>
454 <mml:msup><mml:mi mathvariant="italic">n</mml:mi>
455 <mml:mo></mml:mo>
456 </mml:msup>
457 <mml:mo></mml:mo>
458 <mml:msup><mml:mfenced open="" close="">
459 <mml:msup><mml:mi mathvariant="italic">n</mml:mi>
460 <mml:mo></mml:mo>
461 </mml:msup>
462 </mml:mfenced>
463 <mml:mi mathvariant="italic">T</mml:mi>
464 </mml:msup>
465 <mml:mo></mml:mo>
466 <mml:mi mathvariant="italic">u</mml:mi>
467 </mml:mrow>
468 </mml:mrow>
469 </mml:math>
470 </p><p>
471 Finally, let
472 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
473
474 <mml:mrow>
475 <mml:mi mathvariant="italic">m</mml:mi>
476 <mml:mo>=</mml:mo>
477 <mml:mrow>
478 <mml:mn>2</mml:mn>
479 <mml:mo></mml:mo>
480 <mml:msqrt>
481 <mml:mfenced open="(" close=")">
482 <mml:mrow>
483 <mml:msup><mml:mfenced open="" close="">
484 <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
485 <mml:mi mathvariant="italic">x</mml:mi>
486 </mml:msub>
487 </mml:mfenced>
488 <mml:mn>2</mml:mn>
489 </mml:msup>
490 <mml:mo>+</mml:mo>
491 <mml:msup><mml:mfenced open="" close="">
492 <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
493 <mml:mi mathvariant="italic">y</mml:mi>
494 </mml:msub>
495 </mml:mfenced>
496 <mml:mn>2</mml:mn>
497 </mml:msup>
498 <mml:mo>+</mml:mo>
499 <mml:msup><mml:mfenced open="(" close=")">
500 <mml:mrow>
501 <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
502 <mml:mi mathvariant="italic">z</mml:mi>
503 </mml:msub>
504 <mml:mo>+</mml:mo>
505 <mml:mn>1</mml:mn>
506 </mml:mrow>
507 </mml:mfenced>
508 <mml:mn>2</mml:mn>
509 </mml:msup>
510 </mml:mrow>
511 </mml:mfenced>
512 </mml:msqrt>
513 </mml:mrow>
514 </mml:mrow>
515 </mml:math>.
516 Then the values assigned to the
517 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math>
518 and
519 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">t</mml:mi></mml:math>
520 texture coordinates are
521 </p><p>
522 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
523
524 <mml:mrow>
525 <mml:mi mathvariant="italic">s</mml:mi>
526 <mml:mo>=</mml:mo>
527 <mml:mrow>
528 <mml:mfrac>
529 <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
530 <mml:mi mathvariant="italic">x</mml:mi>
531 </mml:msub>
532 <mml:mi mathvariant="italic">m</mml:mi>
533 </mml:mfrac>
534 <mml:mo>+</mml:mo>
535 <mml:mfrac>
536 <mml:mn>1</mml:mn>
537 <mml:mn>2</mml:mn>
538 </mml:mfrac>
539 </mml:mrow>
540 </mml:mrow>
541 </mml:math>
542 </p><p>
543 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
544
545 <mml:mrow>
546 <mml:mi mathvariant="italic">t</mml:mi>
547 <mml:mo>=</mml:mo>
548 <mml:mrow>
549 <mml:mfrac>
550 <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
551 <mml:mi mathvariant="italic">y</mml:mi>
552 </mml:msub>
553 <mml:mi mathvariant="italic">m</mml:mi>
554 </mml:mfrac>
555 <mml:mo>+</mml:mo>
556 <mml:mfrac>
557 <mml:mn>1</mml:mn>
558 <mml:mn>2</mml:mn>
559 </mml:mfrac>
560 </mml:mrow>
561 </mml:mrow>
562 </mml:math>
563 </p><p>
564 To enable or disable a texture-coordinate generation function, call
565 <a href="glEnable.xml"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a> or <a href="glDisable.xml"><span class="citerefentry"><span class="refentrytitle">glDisable</span></span></a>
566 with one of the symbolic texture-coordinate names
567 (<code class="constant">GL_TEXTURE_GEN_S</code>,
568 <code class="constant">GL_TEXTURE_GEN_T</code>,
569 <code class="constant">GL_TEXTURE_GEN_R</code>, or
570 <code class="constant">GL_TEXTURE_GEN_Q</code>) as the argument.
571 When enabled,
572 the specified texture coordinate is computed
573 according to the generating function associated with that coordinate.
574 When disabled,
575 subsequent vertices take the specified texture coordinate
576 from the current set of texture coordinates. Initially, all texture
577 generation functions are set to <code class="constant">GL_EYE_LINEAR</code> and are disabled.
578 Both
579 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math>
580 plane equations are (1, 0, 0, 0),
581 both
582 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">t</mml:mi></mml:math>
583 plane equations are (0, 1, 0, 0),
584 and all
585 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math>
586 and
587 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">q</mml:mi></mml:math>
588 plane equations are (0, 0, 0, 0).
589 </p><p>
590 When the <code class="code">ARB_multitexture</code> extension is supported, <code class="function">glTexGen</code> sets the
591 texture generation parameters for the currently active texture unit,
592 selected with <a href="glActiveTexture.xml"><span class="citerefentry"><span class="refentrytitle">glActiveTexture</span></span></a>.
593 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
594 <code class="constant">GL_INVALID_ENUM</code> is generated when <em class="parameter"><code>coord</code></em> or <em class="parameter"><code>pname</code></em> is not an
595 accepted defined value,
596 or when <em class="parameter"><code>pname</code></em> is <code class="constant">GL_TEXTURE_GEN_MODE</code> and <em class="parameter"><code>params</code></em> is not an
597 accepted defined value.
598 </p><p>
599 <code class="constant">GL_INVALID_ENUM</code> is generated when <em class="parameter"><code>pname</code></em> is <code class="constant">GL_TEXTURE_GEN_MODE</code>,
600 <em class="parameter"><code>params</code></em> is <code class="constant">GL_SPHERE_MAP</code>,
601 and <em class="parameter"><code>coord</code></em> is either <code class="constant">GL_R</code> or <code class="constant">GL_Q</code>.
602 </p><p>
603 <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glTexGen</code>
604 is executed between the execution of <a href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>
605 and the corresponding execution of <a href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
606 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
607 <a href="glGetTexGen.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexGen</span></span></a>
608 </p><p>
609 <a href="glIsEnabled.xml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_TEXTURE_GEN_S</code>
610 </p><p>
611 <a href="glIsEnabled.xml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_TEXTURE_GEN_T</code>
612 </p><p>
613 <a href="glIsEnabled.xml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_TEXTURE_GEN_R</code>
614 </p><p>
615 <a href="glIsEnabled.xml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_TEXTURE_GEN_Q</code>
616 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
617 <a href="glActiveTexture.xml"><span class="citerefentry"><span class="refentrytitle">glActiveTexture</span></span></a>,
618 <a href="glCopyPixels.xml"><span class="citerefentry"><span class="refentrytitle">glCopyPixels</span></span></a>,
619 <a href="glCopyTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a>,
620 <a href="glCopyTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage1D</span></span></a>,
621 <a href="glCopyTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage2D</span></span></a>,
622 <a href="glCopyTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage3D</span></span></a>,
623 <a href="glTexEnv.xml"><span class="citerefentry"><span class="refentrytitle">glTexEnv</span></span></a>,
624 <a href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>,
625 <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>,
626 <a href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>,
627 <a href="glTexParameter.xml"><span class="citerefentry"><span class="refentrytitle">glTexParameter</span></span></a>,
628 <a href="glTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage1D</span></span></a>,
629 <a href="glTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage2D</span></span></a>,
630 <a href="glTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage3D</span></span></a>
631 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
632 Copyright <span class="trademark"></span>© 1991-2006
633 Silicon Graphics, Inc. This document is licensed under the SGI
634 Free Software B License. For details, see
635 <a href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
636 </p></div></div></body></html>