<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:mml="http://www.w3.org/1998/Math/MathML"
><head><title>gluBuild2DMipmapLevels</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"/><link rel="home" href="index.xml" title="PyOpenGL 2.0.1.07 Man Pages"/><link rel="up" href="reference-GLU.xml" title="GLU"/><link rel="previous" href="gluBuild1DMipmaps.3G.xml" title="gluBuild1DMipmaps"/><link rel="next" href="gluBuild2DMipmaps.3G.xml" title="gluBuild2DMipmaps"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gluBuild2DMipmapLevels</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="gluBuild1DMipmaps.3G.xml">Prev</a> </td><th width="60%" align="center">GLU</th><td width="20%" align="right"> <a accesskey="n" href="gluBuild2DMipmaps.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="gluBuild2DMipmapLevels.3G"/><div class="titlepage"/><div class="refnamediv"><a name="gluBuild2DMipmapLevels.3G-name"/><h2>Name</h2><p>gluBuild2DMipmapLevels, gluBuild2DMipmapLevelsb, gluBuild2DMipmapLevelsf, gluBuild2DMipmapLevelsi, gluBuild2DMipmapLevelss, gluBuild2DMipmapLevelsub, gluBuild2DMipmapLevelsui, gluBuild2DMipmapLevelsus &#8212; builds a subset of two-dimensional mipmap levels</p></div><div class="refsynopsisdiv"><a name="gluBuild2DMipmapLevels.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>GLint <tt>gluBuild2DMipmapLevels</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>target</tt></i>, GLint <i><tt>internalFormat</tt></i>, GLsizei <i><tt>width</tt></i>, GLsizei <i><tt>height</tt></i>, GLenum <i><tt>format</tt></i>, GLenum <i><tt>type</tt></i>, GLint <i><tt>level</tt></i>, GLint <i><tt>base</tt></i>, GLint <i><tt>max</tt></i>, const void *<i><tt>data</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="gluBuild2DMipmapLevels.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>gluBuild2DMipmapLevels</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>internalFormat</tt></i>, <i><tt>width</tt></i>, <i><tt>height</tt></i>, <i><tt>format</tt></i>, <i><tt>type</tt></i>, <i><tt>level</tt></i>, <i><tt>base</tt></i>, <i><tt>max</tt></i>, <i><tt>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild2DMipmapLevelsb</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>internalFormat</tt></i>, <i><tt>format</tt></i>, <i><tt>level</tt></i>, <i><tt>base</tt></i>, <i><tt>max</tt></i>, <i><tt>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild2DMipmapLevelsf</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>internalFormat</tt></i>, <i><tt>format</tt></i>, <i><tt>level</tt></i>, <i><tt>base</tt></i>, <i><tt>max</tt></i>, <i><tt>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild2DMipmapLevelsi</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>internalFormat</tt></i>, <i><tt>format</tt></i>, <i><tt>level</tt></i>, <i><tt>base</tt></i>, <i><tt>max</tt></i>, <i><tt>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild2DMipmapLevelss</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>internalFormat</tt></i>, <i><tt>format</tt></i>, <i><tt>level</tt></i>, <i><tt>base</tt></i>, <i><tt>max</tt></i>, <i><tt>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild2DMipmapLevelsub</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>internalFormat</tt></i>, <i><tt>format</tt></i>, <i><tt>level</tt></i>, <i><tt>base</tt></i>, <i><tt>max</tt></i>, <i><tt>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild2DMipmapLevelsui</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>internalFormat</tt></i>, <i><tt>format</tt></i>, <i><tt>level</tt></i>, <i><tt>base</tt></i>, <i><tt>max</tt></i>, <i><tt>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild2DMipmapLevelsus</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>internalFormat</tt></i>, <i><tt>format</tt></i>, <i><tt>level</tt></i>, <i><tt>base</tt></i>, <i><tt>max</tt></i>, <i><tt>data</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="gluBuild2DMipmapLevels.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>target</tt></i></span></dt><dd>
						Specifies the target texture. Must be <tt>GL_TEXTURE_2D</tt>.
					</dd><dt><span class="term"><i><tt>internalFormat</tt></i></span></dt><dd>
						Requests the internal storage format of the texture image. Must be 1, 2, 3, 4, or one of the following
						symbolic constants: <tt>GL_ALPHA</tt>, <tt>GL_ALPHA4</tt>,
						<tt>GL_ALPHA8</tt>, <tt>GL_ALPHA12</tt>, <tt>GL_ALPHA16</tt>,
						<tt>GL_LUMINANCE</tt>, <tt>GL_LUMINANCE4</tt>, <tt>GL_LUMINANCE8</tt>,
						<tt>GL_LUMINANCE12</tt>, <tt>GL_LUMINANCE16</tt>,
						<tt>GL_LUMINANCE_ALPHA</tt>, <tt>GL_LUMINANCE4_ALPHA4</tt>,
						<tt>GL_LUMINANCE6_ALPHA2</tt>, <tt>GL_LUMINANCE8_ALPHA8</tt>,
						<tt>GL_LUMINANCE12_ALPHA4</tt>, <tt>GL_LUMINANCE12_ALPHA12</tt>,
						<tt>GL_LUMINANCE16_ALPHA16</tt>, <tt>GL_INTENSITY</tt>,
						<tt>GL_INTENSITY4</tt>, <tt>GL_INTENSITY8</tt>,
						<tt>GL_INTENSITY12</tt>, <tt>GL_INTENSITY16</tt>, <tt>GL_RGB</tt>,
						<tt>GL_R3_G3_B2</tt>, <tt>GL_RGB4</tt>, <tt>GL_RGB5</tt>,
						<tt>GL_RGB8</tt>, <tt>GL_RGB10</tt>, <tt>GL_RGB12</tt>,
						<tt>GL_RGB16</tt>, <tt>GL_RGBA</tt>, <tt>GL_RGBA2</tt>,
						<tt>GL_RGBA4</tt>, <tt>GL_RGB5_A1</tt>, <tt>GL_RGBA8</tt>,
						<tt>GL_RGB10_A2</tt>, <tt>GL_RGBA12</tt> or <tt>GL_RGBA16</tt>.
					</dd><dt><span class="term"><i><tt>width</tt></i>, <i><tt>height</tt></i></span></dt><dd>
						Specifies the width and height, respectively, in pixels of the texture image. These should be a power of 2.
					</dd><dt><span class="term"><i><tt>format</tt></i></span></dt><dd>
						Specifies the format of the pixel data. Must be one of <tt>GL_COLOR_INDEX</tt>,
						<tt>GL_DEPTH_COMPONENT</tt>, <tt>GL_RED</tt>, <tt>GL_GREEN</tt>,
						<tt>GL_BLUE</tt>, <tt>GL_ALPHA</tt>, <tt>GL_RGB</tt>,
						<tt>GL_RGBA</tt>, <tt>GL_BGR</tt>, <tt>GL_BGRA</tt>,
						<tt>GL_LUMINANCE</tt>, or <tt>GL_LUMINANCE_ALPHA</tt>.
					</dd><dt><span class="term"><i><tt>type</tt></i></span></dt><dd>
						Specifies the data type for <i><tt>data</tt></i>. Must be one of
						<tt>GL_UNSIGNED_BYTE</tt>, <tt>GL_BYTE</tt>, <tt>GL_BITMAP</tt>,
						<tt>GL_UNSIGNED_SHORT</tt>, <tt>GL_SHORT</tt>,
						<tt>GL_UNSIGNED_INT</tt>, <tt>GL_INT</tt>, <tt>GL_FLOAT</tt>,
						<tt>GL_UNSIGNED_BYTE_3_3_2</tt>, <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt>,
						<tt>GL_UNSIGNED_SHORT_5_6_5</tt>, <tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt>,
						<tt>GL_UNSIGNED_SHORT_4_4_4_4</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt>,
						<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt>, <tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt>,
						<tt>GL_UNSIGNED_INT_8_8_8_8</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt>,
						<tt>GL_UNSIGNED_INT_10_10_10_2</tt> or <tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt>.
					</dd><dt><span class="term"><i><tt>level</tt></i></span></dt><dd>
						Specifies the mipmap level of the image data.
					</dd><dt><span class="term"><i><tt>base</tt></i></span></dt><dd>
						Specifies the minimum mipmap level to pass to <a href="glTexImage2D.3G.xml"><tt>glTexImage2D</tt></a>.
					</dd><dt><span class="term"><i><tt>max</tt></i></span></dt><dd>
						Specifies the maximum mipmap level to pass to <a href="glTexImage2D.3G.xml"><tt>glTexImage2D</tt></a>.
					</dd><dt><span class="term"><i><tt>data</tt></i></span></dt><dd>
						Specifies a pointer to the image data in memory.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="gluBuild2DMipmapLevels.3G-description"/><h2>Description</h2><p>
			<tt>gluBuild2DMipmapLevels</tt> builds a subset of prefiltered two-dimensional texture maps of decreasing
			resolutions called a mipmap. This is used for the antialiasing of texture mapped primitives.
		</p><p>
			A return value of zero indicates success, otherwise a GLU error code is returned (see <a href="gluErrorString.3G.xml">gluErrorString</a>).
		</p><p>
			A series of mipmap levels from <i><tt>base</tt></i> to <i><tt>max</tt></i> is built by decimating
			<i><tt>data</tt></i> in half along both dimensions until size <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mn>1</mml:mn>
						<mml:mo>×</mml:mo>
						<mml:mn>1</mml:mn>
					</mml:mrow>
				</mml:math> is reached. At each level, each texel in the halved mipmap level is an average of the corresponding
			four texels in the larger mipmap level. (In the case of rectangular images, the decimation will ultimately reach an
			<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mi>N</mml:mi>
						<mml:mo>×</mml:mo>
						<mml:mn>1</mml:mn>
					</mml:mrow>
				</mml:math> or <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mn>1</mml:mn>
						<mml:mo>×</mml:mo>
						<mml:mi>N</mml:mi>
					</mml:mrow>
				</mml:math> configuration. Here, two texels are averaged instead.) <a href="glTexImage2D.3G.xml"><tt>glTexImage2D</tt></a> is called to load these mipmap levels from <i><tt>base</tt></i> to
			<i><tt>max</tt></i>. If <i><tt>max</tt></i> is larger than the highest mipmap level for the texture of
			the specified size, then a GLU error code is returned (see <a href="gluErrorString.3G.xml"><tt>gluErrorString</tt></a>) and
			nothing is loaded.
		</p><p>
			For example, if <i><tt>level</tt></i> is 2 and <i><tt>width</tt></i> is 16 and
			<i><tt>height</tt></i> is 8, the following levels are possible: <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mn>16</mml:mn>
						<mml:mo>×</mml:mo>
						<mml:mn>8</mml:mn>
					</mml:mrow>
				</mml:math>, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mn>8</mml:mn>
						<mml:mo>×</mml:mo>
						<mml:mn>4</mml:mn>
					</mml:mrow>
				</mml:math>, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mn>4</mml:mn>
						<mml:mo>×</mml:mo>
						<mml:mn>2</mml:mn>
					</mml:mrow>
				</mml:math>, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mn>2</mml:mn>
						<mml:mo>×</mml:mo>
						<mml:mn>1</mml:mn>
					</mml:mrow>
				</mml:math>, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mn>1</mml:mn>
						<mml:mo>×</mml:mo>
						<mml:mn>1</mml:mn>
					</mml:mrow>
				</mml:math>. These correspond to levels 2 through 6 respectively. If <i><tt>base</tt></i> is 3 and
			<i><tt>max</tt></i> is 5, then only mipmap levels <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mn>8</mml:mn>
						<mml:mo>×</mml:mo>
						<mml:mn>4</mml:mn>
					</mml:mrow>
				</mml:math>, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mn>4</mml:mn>
						<mml:mo>×</mml:mo>
						<mml:mn>2</mml:mn>
					</mml:mrow>
				</mml:math> and <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mn>2</mml:mn>
						<mml:mo>×</mml:mo>
						<mml:mn>1</mml:mn>
					</mml:mrow>
				</mml:math> are loaded. However, if <i><tt>max</tt></i> is 7 then an error is returned and nothing is
			loaded since <i><tt>max</tt></i> is larger than the highest mipmap level which is, in this case, 6.
		</p><p>
			The highest mipmap level can be derived from the formula
			log2(max(<i><tt>width</tt></i>,<i><tt>height</tt></i>)*(2^<i><tt>level</tt></i>)).
		</p><p>
			See the <a href="glTexImage1D.3G.xml"><tt>glTexImage1D</tt></a> reference page for a description of the acceptable values
			for <i><tt>format</tt></i> parameter. See the <a href="glDrawPixels.3G.xml"><tt>glDrawPixels</tt></a> reference
			page for a description of the acceptable values for <i><tt>type</tt></i> parameter.
		</p></div><div class="refsect1" lang="en"><a name="gluBuild2DMipmapLevels.3G-notes"/><h2>Notes</h2><p>
			<tt>gluBuild2DMipmapLevels</tt> is only available if the GLU version is 1.3 or greater.
		</p><p>
			Formats <tt>GL_BGR</tt>, and <tt>GL_BGRA</tt>, and types
			<tt>GL_UNSIGNED_BYTE_3_3_2</tt>, <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_5_6_5</tt>, <tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_4_4_4_4</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt>, <tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt>,
			<tt>GL_UNSIGNED_INT_8_8_8_8</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt>,
			<tt>GL_UNSIGNED_INT_10_10_10_2</tt>, and <tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt> are only
			available if the GL version is 1.2 or greater.
		</p></div><div class="refsect1" lang="en"><a name="gluBuild2DMipmapLevels.3G-errors"/><h2>Errors</h2><p>
			<tt>GLU_INVALID_VALUE</tt> is returned if <i><tt>level</tt></i> &gt; <i><tt>base</tt></i>,
			<i><tt>base</tt></i> &lt; 0, <i><tt>max</tt></i> &lt; <i><tt>base</tt></i> or
			<i><tt>max</tt></i> is &gt; the highest mipmap level for <i><tt>data</tt></i>.
		</p><p>
			<tt>GLU_INVALID_VALUE</tt> is returned if <i><tt>width</tt></i> or <i><tt>height</tt></i> is
			&lt; 1.
		</p><p>
			<tt>GLU_INVALID_ENUM</tt> is returned if <i><tt>internalFormat</tt></i>,
			<i><tt>format</tt></i>, or <i><tt>type</tt></i> is not legal.
		</p><p>
			<tt>GLU_INVALID_OPERATION</tt> is returned if <i><tt>type</tt></i> is
			<tt>GL_UNSIGNED_BYTE_3_3_2</tt> or <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt> and
			<i><tt>format</tt></i> is not <tt>GL_RGB</tt>.
		</p><p>
			<tt>GLU_INVALID_OPERATION</tt> is returned if <i><tt>type</tt></i> is
			<tt>GL_UNSIGNED_SHORT_5_6_5</tt> or <tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt> and
			<i><tt>format</tt></i> is not <tt>GL_RGB</tt>.
		</p><p>
			<tt>GLU_INVALID_OPERATION</tt> is returned if <i><tt>type</tt></i> is
			<tt>GL_UNSIGNED_SHORT_4_4_4_4</tt> or <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt> and
			<i><tt>format</tt></i> is neither <tt>GL_RGBA</tt> nor <tt>GL_BGRA</tt>.
		</p><p>
			<tt>GLU_INVALID_OPERATION</tt> is returned if <i><tt>type</tt></i> is
			<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt> or <tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt> and
			<i><tt>format</tt></i> is neither <tt>GL_RGBA</tt> nor <tt>GL_BGRA</tt>.
		</p><p>
			<tt>GLU_INVALID_OPERATION</tt> is returned if <i><tt>type</tt></i> is
			<tt>GL_UNSIGNED_INT_8_8_8_8</tt> or <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt> and
			<i><tt>format</tt></i> is neither <tt>GL_RGBA</tt> nor <tt>GL_BGRA</tt>.
		</p><p>
			<tt>GLU_INVALID_OPERATION</tt> is returned if <i><tt>type</tt></i> is
			<tt>GL_UNSIGNED_INT_10_10_10_2</tt> or <tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt> and
			<i><tt>format</tt></i> is neither <tt>GL_RGBA</tt> nor <tt>GL_BGRA</tt>.
		</p></div><div class="refsect1" lang="en"><a name="gluBuild2DMipmapLevels.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glDrawPixels.3G.xml">glDrawPixels</a>, <a href="glTexImage1D.3G.xml">glTexImage1D</a>, <a href="glTexImage2D.3G.xml">glTexImage2D</a>, <a href="glTexImage3D.3G.xml">glTexImage3D</a>, <a href="gluBuild1DMipmaps.3G.xml">gluBuild1DMipmaps</a>, <a href="gluBuild2DMipmaps.3G.xml">gluBuild2DMipmaps</a>, <a href="gluBuild3DMipmaps.3G.xml">gluBuild3DMipmaps</a>, <a href="gluErrorString.3G.xml">gluErrorString</a>, <a href="glGetTexImage.3G.xml">glGetTexImage</a>, <a href="glGetTexLevelParameter.3G.xml">glGetTexLevelParameter</a>, <a href="gluBuild1DMipmapLevels.3G.xml">gluBuild1DMipmapLevels</a>, <a href="gluBuild3DMipmapLevels.3G.xml">gluBuild3DMipmapLevels</a></span>
		</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="gluBuild1DMipmaps.3G.xml">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-GLU.xml">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="gluBuild2DMipmaps.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gluBuild1DMipmaps </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> gluBuild2DMipmaps</td></tr></table></div></body></html>
