<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
<!-- saved from url=(0013)about:internet -->
<?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>
                    Specifies a texture coordinate.
                    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>.
                </p></dd><dt><span class="term"><em class="parameter"><code>pname</code></em></span></dt><dd><p>
                    Specifies the symbolic name of the texture-coordinate generation function.
                    Must be <code class="constant">GL_TEXTURE_GEN_MODE</code>.
                </p></dd><dt><span class="term"><em class="parameter"><code>param</code></em></span></dt><dd><p>
                    Specifies a single-valued texture generation parameter,
                    one of <code class="constant">GL_OBJECT_LINEAR</code>, <code class="constant">GL_EYE_LINEAR</code>, <code class="constant">GL_SPHERE_MAP</code>,
                    <code class="constant">GL_NORMAL_MAP</code>, or <code class="constant">GL_REFLECTION_MAP</code>.
                </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>
                    Specifies a texture coordinate.
                    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>.
                </p></dd><dt><span class="term"><em class="parameter"><code>pname</code></em></span></dt><dd><p>
                    Specifies the symbolic name of the texture-coordinate generation function
                    or function parameters.
                    Must be
                    <code class="constant">GL_TEXTURE_GEN_MODE</code>,
                    <code class="constant">GL_OBJECT_PLANE</code>, or
                    <code class="constant">GL_EYE_PLANE</code>.
                </p></dd><dt><span class="term"><em class="parameter"><code>params</code></em></span></dt><dd><p>
                    Specifies a pointer to an array of texture generation parameters.
                    If <em class="parameter"><code>pname</code></em> is <code class="constant">GL_TEXTURE_GEN_MODE</code>,
                    then the array must contain a single symbolic constant,
                    one of
                    <code class="constant">GL_OBJECT_LINEAR</code>,
                    <code class="constant">GL_EYE_LINEAR</code>,
                    <code class="constant">GL_SPHERE_MAP</code>,
                    <code class="constant">GL_NORMAL_MAP</code>, or
                    <code class="constant">GL_REFLECTION_MAP</code>.
                    Otherwise,
                    <em class="parameter"><code>params</code></em> holds the coefficients for the texture-coordinate generation function
                    specified by <em class="parameter"><code>pname</code></em>.
                </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
            <code class="function">glTexGen</code> selects a texture-coordinate generation function
            or supplies coefficients for one of the functions.
            <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
            coordinates; it must be one of the symbols
            <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>.
            <em class="parameter"><code>pname</code></em> must be one of three symbolic constants:
            <code class="constant">GL_TEXTURE_GEN_MODE</code>,
            <code class="constant">GL_OBJECT_PLANE</code>, or
            <code class="constant">GL_EYE_PLANE</code>.
            If <em class="parameter"><code>pname</code></em> is <code class="constant">GL_TEXTURE_GEN_MODE</code>,
            then <em class="parameter"><code>params</code></em> chooses a mode,
            one of
            <code class="constant">GL_OBJECT_LINEAR</code>,
            <code class="constant">GL_EYE_LINEAR</code>,
            <code class="constant">GL_SPHERE_MAP</code>,
            <code class="constant">GL_NORMAL_MAP</code>, or
            <code class="constant">GL_REFLECTION_MAP</code>.
            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>,
            <em class="parameter"><code>params</code></em> contains coefficients for the corresponding
            texture generation function.
        </p><p>
            If the texture generation function is <code class="constant">GL_OBJECT_LINEAR</code>,
            the function
        </p><p>
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:mi mathvariant="italic">g</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mrow>
                        <mml:mrow>
                            <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                            <mml:mn>1</mml:mn>
                            </mml:msub>
                            <mml:mo>×</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
                            <mml:mi mathvariant="italic">o</mml:mi>
                            </mml:msub>
                        </mml:mrow>
                        <mml:mo>+</mml:mo>
                        <mml:mrow>
                            <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                            <mml:mn>2</mml:mn>
                            </mml:msub>
                            <mml:mo>×</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
                            <mml:mi mathvariant="italic">o</mml:mi>
                            </mml:msub>
                        </mml:mrow>
                        <mml:mo>+</mml:mo>
                        <mml:mrow>
                            <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                            <mml:mn>3</mml:mn>
                            </mml:msub>
                            <mml:mo>×</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">z</mml:mi>
                            <mml:mi mathvariant="italic">o</mml:mi>
                            </mml:msub>
                        </mml:mrow>
                        <mml:mo>+</mml:mo>
                        <mml:mrow>
                            <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                            <mml:mn>4</mml:mn>
                            </mml:msub>
                            <mml:mo>×</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">w</mml:mi>
                            <mml:mi mathvariant="italic">o</mml:mi>
                            </mml:msub>
                        </mml:mrow>
                    </mml:mrow>
                </mml:mrow>
            </mml:math>
        </p><p>
            is used, where 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">g</mml:mi></mml:math>
            is the value computed for the coordinate named in <em class="parameter"><code>coord</code></em>,
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>1</mml:mn>
                </mml:msub>
            </mml:math>,
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>2</mml:mn>
                </mml:msub>
            </mml:math>,
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>3</mml:mn>
                </mml:msub>
            </mml:math>,
            and
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>4</mml:mn>
                </mml:msub>
            </mml:math>
            are the four values supplied in <em class="parameter"><code>params</code></em>, and
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
                <mml:mi mathvariant="italic">o</mml:mi>
                </mml:msub>
            </mml:math>,
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
                <mml:mi mathvariant="italic">o</mml:mi>
                </mml:msub>
            </mml:math>,
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">z</mml:mi>
                <mml:mi mathvariant="italic">o</mml:mi>
                </mml:msub>
            </mml:math>,
            and
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">w</mml:mi>
                <mml:mi mathvariant="italic">o</mml:mi>
                </mml:msub>
            </mml:math>
            are the object coordinates of the vertex.
            This function can be used, for example, to texture-map terrain using sea level
            as a reference plane
            (defined by 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>1</mml:mn>
                </mml:msub>
            </mml:math>, 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>2</mml:mn>
                </mml:msub>
            </mml:math>, 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>3</mml:mn>
                </mml:msub>
            </mml:math>,
            and 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>4</mml:mn>
                </mml:msub>
            </mml:math>).
            The altitude of a terrain vertex is computed by the <code class="constant">GL_OBJECT_LINEAR</code>
            coordinate generation function as its distance from sea level;
            that altitude can then be used to index the texture image to map white snow
            onto peaks and green grass onto foothills.
        </p><p>
            If the texture generation function is <code class="constant">GL_EYE_LINEAR</code>, the function
        </p><p>
            </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:mi mathvariant="italic">g</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mrow>
                        <mml:mrow>
                            <mml:msup><mml:mfenced open="" close="">
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>1</mml:mn>
                                </mml:msub>
                            </mml:mfenced>
                            <mml:mo>″</mml:mo>
                            </mml:msup>
                            <mml:mo>×</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
                            <mml:mi mathvariant="italic">e</mml:mi>
                            </mml:msub>
                        </mml:mrow>
                        <mml:mo>+</mml:mo>
                        <mml:mrow>
                            <mml:msup><mml:mfenced open="" close="">
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>2</mml:mn>
                                </mml:msub>
                            </mml:mfenced>
                            <mml:mo>″</mml:mo>
                            </mml:msup>
                            <mml:mo>×</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
                            <mml:mi mathvariant="italic">e</mml:mi>
                            </mml:msub>
                        </mml:mrow>
                        <mml:mo>+</mml:mo>
                        <mml:mrow>
                            <mml:msup><mml:mfenced open="" close="">
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>3</mml:mn>
                                </mml:msub>
                            </mml:mfenced>
                            <mml:mo>″</mml:mo>
                            </mml:msup>
                            <mml:mo>×</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">z</mml:mi>
                            <mml:mi mathvariant="italic">e</mml:mi>
                            </mml:msub>
                        </mml:mrow>
                        <mml:mo>+</mml:mo>
                        <mml:mrow>
                            <mml:msup><mml:mfenced open="" close="">
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>4</mml:mn>
                                </mml:msub>
                            </mml:mfenced>
                            <mml:mo>″</mml:mo>
                            </mml:msup>
                            <mml:mo>×</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">w</mml:mi>
                            <mml:mi mathvariant="italic">e</mml:mi>
                            </mml:msub>
                        </mml:mrow>
                    </mml:mrow>
                </mml:mrow>
            </mml:math></div><p>
        </p><p>
            is used, where
        </p><p>
            </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:mfenced open="(" close=")">
                        <mml:mrow>
                            <mml:msup><mml:mfenced open="" close="">
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>1</mml:mn>
                                </mml:msub>
                            </mml:mfenced>
                            <mml:mo>″</mml:mo>
                            </mml:msup>
                            <mml:mo>⁢</mml:mo>
                            <mml:msup><mml:mfenced open="" close="">
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>2</mml:mn>
                                </mml:msub>
                            </mml:mfenced>
                            <mml:mo>″</mml:mo>
                            </mml:msup>
                            <mml:mo>⁢</mml:mo>
                            <mml:msup><mml:mfenced open="" close="">
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>3</mml:mn>
                                </mml:msub>
                            </mml:mfenced>
                            <mml:mo>″</mml:mo>
                            </mml:msup>
                            <mml:mo>⁢</mml:mo>
                            <mml:msup><mml:mfenced open="" close="">
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>4</mml:mn>
                                </mml:msub>
                            </mml:mfenced>
                            <mml:mo>″</mml:mo>
                            </mml:msup>
                        </mml:mrow>
                    </mml:mfenced>
                    <mml:mo>=</mml:mo>
                    <mml:mrow>
                        <mml:mfenced open="(" close=")">
                            <mml:mrow>
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>1</mml:mn>
                                </mml:msub>
                                <mml:mo>⁢</mml:mo>
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>2</mml:mn>
                                </mml:msub>
                                <mml:mo>⁢</mml:mo>
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>3</mml:mn>
                                </mml:msub>
                                <mml:mo>⁢</mml:mo>
                                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                                <mml:mn>4</mml:mn>
                                </mml:msub>
                            </mml:mrow>
                        </mml:mfenced>
                        <mml:mo>⁢</mml:mo>
                        <mml:msup><mml:mi mathvariant="italic">M</mml:mi>
                        <mml:mn>-1</mml:mn>
                        </mml:msup>
                    </mml:mrow>
                </mml:mrow>
            </mml:math></div><p>
        </p><p>
            and
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
                <mml:mi mathvariant="italic">e</mml:mi>
                </mml:msub>
            </mml:math>,
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
                <mml:mi mathvariant="italic">e</mml:mi>
                </mml:msub>
            </mml:math>,
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">z</mml:mi>
                <mml:mi mathvariant="italic">e</mml:mi>
                </mml:msub>
            </mml:math>,
            and
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">w</mml:mi>
                <mml:mi mathvariant="italic">e</mml:mi>
                </mml:msub>
            </mml:math>
            are the eye coordinates of the vertex,
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>1</mml:mn>
                </mml:msub>
            </mml:math>,
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>2</mml:mn>
                </mml:msub>
            </mml:math>,
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>3</mml:mn>
                </mml:msub>
            </mml:math>,
            and
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:msub><mml:mi mathvariant="italic">p</mml:mi>
                <mml:mn>4</mml:mn>
                </mml:msub>
            </mml:math>
            are the values supplied in <em class="parameter"><code>params</code></em>, and
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">M</mml:mi></mml:math>
            is the modelview matrix when <code class="function">glTexGen</code> is invoked.
            If 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">M</mml:mi></mml:math>
            is poorly conditioned or singular,
            texture coordinates generated by the resulting function may be inaccurate
            or undefined.
        </p><p>
            Note that the values in <em class="parameter"><code>params</code></em> define a reference plane in eye coordinates.
            The modelview matrix that is applied to them may not be the same one
            in effect when the polygon vertices are transformed.
            This function establishes a field of texture coordinates
            that can produce dynamic contour lines on moving objects.
        </p><p>
            If the texture generation function is <code class="constant">GL_SPHERE_MAP</code> and <em class="parameter"><code>coord</code></em> is either
            <code class="constant">GL_S</code> or
            <code class="constant">GL_T</code>,
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math>
            and 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">t</mml:mi></mml:math>
            texture coordinates are generated as follows.
            Let <span class="emphasis"><em>u</em></span> be the unit vector pointing from the origin to the polygon vertex
            (in eye coordinates).
            Let <span class="emphasis"><em>n</em></span> sup prime be the current normal,
            after transformation to eye coordinates.
            Let
        </p><p>
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:mi mathvariant="italic">f</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:msup><mml:mfenced open="(" close=")">
                        <mml:mrow>
                            <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
                            <mml:mi mathvariant="italic">x</mml:mi>
                            </mml:msub>
                            <mml:mo>⁢</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
                            <mml:mi mathvariant="italic">y</mml:mi>
                            </mml:msub>
                            <mml:mo>⁢</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
                            <mml:mi mathvariant="italic">z</mml:mi>
                            </mml:msub>
                        </mml:mrow>
                    </mml:mfenced>
                    <mml:mi mathvariant="italic">T</mml:mi>
                    </mml:msup>
                </mml:mrow>
            </mml:math>
            be the reflection vector such that
        </p><p>
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:mi mathvariant="italic">f</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mrow>
                        <mml:mi mathvariant="italic">u</mml:mi>
                        <mml:mo>-</mml:mo>
                        <mml:mn>2</mml:mn>
                        <mml:mo>⁢</mml:mo>
                        <mml:msup><mml:mi mathvariant="italic">n</mml:mi>
                        <mml:mo>″</mml:mo>
                        </mml:msup>
                        <mml:mo>⁢</mml:mo>
                        <mml:msup><mml:mfenced open="" close="">
                            <mml:msup><mml:mi mathvariant="italic">n</mml:mi>
                            <mml:mo>″</mml:mo>
                            </mml:msup>
                        </mml:mfenced>
                        <mml:mi mathvariant="italic">T</mml:mi>
                        </mml:msup>
                        <mml:mo>⁢</mml:mo>
                        <mml:mi mathvariant="italic">u</mml:mi>
                    </mml:mrow>
                </mml:mrow>
            </mml:math>
        </p><p>
            Finally, let 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:mi mathvariant="italic">m</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mrow>
                        <mml:mn>2</mml:mn>
                        <mml:mo>⁢</mml:mo>
                        <mml:msqrt>
                            <mml:mfenced open="(" close=")">
                                <mml:mrow>
                                    <mml:msup><mml:mfenced open="" close="">
                                        <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
                                        <mml:mi mathvariant="italic">x</mml:mi>
                                        </mml:msub>
                                    </mml:mfenced>
                                    <mml:mn>2</mml:mn>
                                    </mml:msup>
                                    <mml:mo>+</mml:mo>
                                    <mml:msup><mml:mfenced open="" close="">
                                        <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
                                        <mml:mi mathvariant="italic">y</mml:mi>
                                        </mml:msub>
                                    </mml:mfenced>
                                    <mml:mn>2</mml:mn>
                                    </mml:msup>
                                    <mml:mo>+</mml:mo>
                                    <mml:msup><mml:mfenced open="(" close=")">
                                        <mml:mrow>
                                            <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
                                            <mml:mi mathvariant="italic">z</mml:mi>
                                            </mml:msub>
                                            <mml:mo>+</mml:mo>
                                            <mml:mn>1</mml:mn>
                                        </mml:mrow>
                                    </mml:mfenced>
                                    <mml:mn>2</mml:mn>
                                    </mml:msup>
                                </mml:mrow>
                            </mml:mfenced>
                        </mml:msqrt>
                    </mml:mrow>
                </mml:mrow>
            </mml:math>.
            Then the values assigned to the 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math>
            and 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">t</mml:mi></mml:math>
            texture coordinates are
        </p><p>
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:mi mathvariant="italic">s</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mrow>
                        <mml:mfrac>
                            <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
                            <mml:mi mathvariant="italic">x</mml:mi>
                            </mml:msub>
                            <mml:mi mathvariant="italic">m</mml:mi>
                        </mml:mfrac>
                        <mml:mo>+</mml:mo>
                        <mml:mfrac>
                            <mml:mn>1</mml:mn>
                            <mml:mn>2</mml:mn>
                        </mml:mfrac>
                    </mml:mrow>
                </mml:mrow>
            </mml:math>
        </p><p>
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:mi mathvariant="italic">t</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mrow>
                        <mml:mfrac>
                            <mml:msub><mml:mi mathvariant="italic">f</mml:mi>
                            <mml:mi mathvariant="italic">y</mml:mi>
                            </mml:msub>
                            <mml:mi mathvariant="italic">m</mml:mi>
                        </mml:mfrac>
                        <mml:mo>+</mml:mo>
                        <mml:mfrac>
                            <mml:mn>1</mml:mn>
                            <mml:mn>2</mml:mn>
                        </mml:mfrac>
                    </mml:mrow>
                </mml:mrow>
            </mml:math>
        </p><p>
            To enable or disable a texture-coordinate generation function, call
            <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>
            with one of the symbolic texture-coordinate names
            (<code class="constant">GL_TEXTURE_GEN_S</code>,
            <code class="constant">GL_TEXTURE_GEN_T</code>,
            <code class="constant">GL_TEXTURE_GEN_R</code>, or
            <code class="constant">GL_TEXTURE_GEN_Q</code>) as the argument.
            When enabled,
            the specified texture coordinate is computed
            according to the generating function associated with that coordinate.
            When disabled,
            subsequent vertices take the specified texture coordinate
            from the current set of texture coordinates. Initially, all texture
            generation functions are set to <code class="constant">GL_EYE_LINEAR</code> and are disabled.
            Both 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math>
            plane equations are (1, 0, 0, 0),
            both 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">t</mml:mi></mml:math>
            plane equations are (0, 1, 0, 0),
            and all 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math>
            and 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">q</mml:mi></mml:math>
            plane equations are (0, 0, 0, 0).
        </p><p>
            When the <code class="code">ARB_multitexture</code> extension is supported, <code class="function">glTexGen</code> sets the
            texture generation parameters for the currently active texture unit,
            selected with <a href="glActiveTexture.xml"><span class="citerefentry"><span class="refentrytitle">glActiveTexture</span></span></a>.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
            <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
            accepted defined value,
            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
            accepted defined value.
        </p><p>
            <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>,
            <em class="parameter"><code>params</code></em> is <code class="constant">GL_SPHERE_MAP</code>,
            and <em class="parameter"><code>coord</code></em> is either <code class="constant">GL_R</code> or <code class="constant">GL_Q</code>.
        </p><p>
            <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glTexGen</code>
            is executed between the execution of <a href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>
            and the corresponding execution of <a href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
            <a href="glGetTexGen.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexGen</span></span></a>
        </p><p>
            <a href="glIsEnabled.xml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_TEXTURE_GEN_S</code>
        </p><p>
            <a href="glIsEnabled.xml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_TEXTURE_GEN_T</code>
        </p><p>
            <a href="glIsEnabled.xml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_TEXTURE_GEN_R</code>
        </p><p>
            <a href="glIsEnabled.xml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_TEXTURE_GEN_Q</code>
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
            <a href="glActiveTexture.xml"><span class="citerefentry"><span class="refentrytitle">glActiveTexture</span></span></a>,
            <a href="glCopyPixels.xml"><span class="citerefentry"><span class="refentrytitle">glCopyPixels</span></span></a>,
            <a href="glCopyTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a>,
            <a href="glCopyTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage1D</span></span></a>,
            <a href="glCopyTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage2D</span></span></a>,
            <a href="glCopyTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage3D</span></span></a>,
            <a href="glTexEnv.xml"><span class="citerefentry"><span class="refentrytitle">glTexEnv</span></span></a>,
            <a href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>,
            <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>,
            <a href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>,
            <a href="glTexParameter.xml"><span class="citerefentry"><span class="refentrytitle">glTexParameter</span></span></a>,
            <a href="glTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage1D</span></span></a>,
            <a href="glTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage2D</span></span></a>,
            <a href="glTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage3D</span></span></a>
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
            Copyright <span class="trademark"></span>© 1991-2006
            Silicon Graphics, Inc. This document is licensed under the SGI
            Free Software B License. For details, see
            <a href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
        </p></div></div></body></html>
