<?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" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glGenerateMipmap - OpenGL 4 Reference Pages</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glGenerateMipmap"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glGenerateMipmap — generate mipmaps for a specified texture target</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><p><code class="funcdef">void <b class="fsfunc">glGenerateMipmap</b>(</code>GLenum <var class="pdparam">target</var><code>)</code>;</p></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>target</code></em></span></dt><dd><p>
                    Specifies the target to which the texture whose mimaps to generate is bound. <em class="parameter"><code>target</code></em> must
                    be <code class="constant">GL_TEXTURE_1D</code>, <code class="constant">GL_TEXTURE_2D</code>, <code class="constant">GL_TEXTURE_3D</code>,
                    <code class="constant">GL_TEXTURE_1D_ARRAY</code>, <code class="constant">GL_TEXTURE_2D_ARRAY</code> or
                    <code class="constant">GL_TEXTURE_CUBE_MAP</code>.
                </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
            <code class="function">glGenerateMipmap</code> generates mipmaps for the texture attached
            to <em class="parameter"><code>target</code></em> of the active texture unit. For cube map textures,
            a <code class="constant">GL_INVALID_OPERATION</code> error is generated if the texture
            attached to <em class="parameter"><code>target</code></em> is not cube complete.
        </p><p>
            Mipmap generation replaces texel array levels
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:msub>
                        <mml:mi mathvariant="italic">level</mml:mi>
                        <mml:mi>base</mml:mi>
                    </mml:msub>
                    <mml:mo>+</mml:mo>
                    <mml:mn>1</mml:mn>
                </mml:mrow>
            </mml:math>
            through
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                <mml:mrow>
                    <mml:mi mathvariant="italic">q</mml:mi>
                </mml:mrow>
            </mml:math>
            with arrays derived from the
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:msub>
                        <mml:mi mathvariant="italic">level</mml:mi>
                        <mml:mi>base</mml:mi>
                    </mml:msub>
                </mml:mrow>
            </mml:math>
            array, regardless of their previous contents. All other mimap arrays,
            including the
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:msub>
                        <mml:mi mathvariant="italic">level</mml:mi>
                        <mml:mi>base</mml:mi>
                    </mml:msub>
                </mml:mrow>
            </mml:math>
            array, are left unchanged by this computation.
        </p><p>
            The internal formats of the derived mipmap arrays all match those of the
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:msub>
                        <mml:mi mathvariant="italic">level</mml:mi>
                        <mml:mi>base</mml:mi>
                    </mml:msub>
                </mml:mrow>
            </mml:math>
            array. The contents of the derived arrays are computed by repeated, filtered
            reduction of the
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:msub>
                        <mml:mi mathvariant="italic">level</mml:mi>
                        <mml:mi>base</mml:mi>
                    </mml:msub>
                </mml:mrow>
            </mml:math>
            array. For one- and two-dimensional texture arrays, each layer is filtered
            independently.
        </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 if <em class="parameter"><code>target</code></em> is not
            one of the accepted texture targets.
        </p><p>
            <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>target</code></em> is
            <code class="constant">GL_TEXTURE_CUBE_MAP</code> and the texture bound to the <code class="constant">GL_TEXTURE_CUBE_MAP</code>
            target of the active texture unit is not cube complete.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
            <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>,
            <a href="glBindTexture.xml"><span class="citerefentry"><span class="refentrytitle">glBindTexture</span></span></a>,
            <a href="glGenTextures.xml"><span class="citerefentry"><span class="refentrytitle">glGenTextures</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>© 2010 Khronos Group. 
            This material may be distributed subject to the terms and conditions set forth in 
            the Open Publication License, v 1.0, 8 June 1999.
            <a href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>.
        </p></div></div></body></html>
