<?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>gluBuild1DMipmaps</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="gluBuild1DMipmapLevels.3G.xml" title="gluBuild1DMipmapLevels"/><link rel="next" href="gluBuild2DMipmapLevels.3G.xml" title="gluBuild2DMipmapLevels"/></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">gluBuild1DMipmaps</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="gluBuild1DMipmapLevels.3G.xml">Prev</a> </td><th width="60%" align="center">GLU</th><td width="20%" align="right"> <a accesskey="n" href="gluBuild2DMipmapLevels.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="gluBuild1DMipmaps.3G"/><div class="titlepage"/><div class="refnamediv"><a name="gluBuild1DMipmaps.3G-name"/><h2>Name</h2><p>gluBuild1DMipmaps, gluBuild1DMipmapsb, gluBuild1DMipmapsf, gluBuild1DMipmapsi, gluBuild1DMipmapss, gluBuild1DMipmapsub, gluBuild1DMipmapsui, gluBuild1DMipmapsus &#8212; builds a one-dimensional mipmap</p></div><div class="refsynopsisdiv"><a name="gluBuild1DMipmaps.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>GLint <tt>gluBuild1DMipmaps</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>, GLenum <i><tt>format</tt></i>, GLenum <i><tt>type</tt></i>, const void *<i><tt>data</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="gluBuild1DMipmaps.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>gluBuild1DMipmaps</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>format</tt></i>, <i><tt>type</tt></i>, <i><tt>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild1DMipmapsb</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>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild1DMipmapsf</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>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild1DMipmapsi</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>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild1DMipmapss</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>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild1DMipmapsub</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>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild1DMipmapsui</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>data</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>gluBuild1DMipmapsus</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>data</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="gluBuild1DMipmaps.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_1D</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></span></dt><dd>
						Specifies the width, in pixels, of the texture image.
					</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>, <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>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="gluBuild1DMipmaps.3G-description"/><h2>Description</h2><p>
			<tt>gluBuild1DMipmaps</tt> builds a series of prefiltered one-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"><tt>gluErrorString</tt></a>).
		</p><p>
			Initially, the <i><tt>width</tt></i> of <i><tt>data</tt></i> is checked to see if it is a power of 2. If
			not, a copy of <i><tt>data</tt></i> is scaled up or down to the nearest power of 2. (If
			<i><tt>width</tt></i> is exactly between powers of 2, then the copy of <i><tt>data</tt></i> will scale
			upwards.) This copy will be used for subsequent mipmapping operations described below. For example, if
			<i><tt>width</tt></i> is 57 then a copy of <i><tt>data</tt></i> will scale up to 64 before mipmapping
			takes place.
		</p><p>
			Then, proxy textures (see <a href="glTexImage1D.3G.xml">glTexImage1D</a>) are used to determine if the implementation can fit the requested texture. If not,
			<i><tt>width</tt></i> is continually halved until it fits.
		</p><p>
			Next, a series of mipmap levels is built by decimating a copy of <i><tt>data</tt></i> in half until size
			1×1 is reached. At each level, each texel in the halved mipmap level is an average of the corresponding two
			texels in the larger mipmap level.
		</p><p>
			<a href="glTexImage1D.3G.xml"><tt>glTexImage1D</tt></a> is called to load each of these mipmap levels. Level 0 is a copy
			of <i><tt>data</tt></i>. The highest level is <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:msub>
						<mml:mo>log</mml:mo>
						<mml:mn>2</mml:mn>
					</mml:msub>
					<mml:mi>width</mml:mi>
				</mml:math>. For example, if <i><tt>width</tt></i> is 64 and the implementation can store a texture of
			this size, the following mipmap levels are built: 64×1, 32×1, 16×1, 8×1, 4×1, 2×1
			and 1×1. These correspond to levels 0 through 6, respectively.
		</p><p>
			See the <a href="glTexImage1D.3G.xml"><tt>glTexImage1D</tt></a> reference page for a description of the acceptable values
			for the <i><tt>type</tt></i> parameter. See the <a href="glDrawPixels.3G.xml"><tt>glDrawPixels</tt></a> reference
			page for a description of the acceptable values for the <i><tt>data</tt></i> parameter.
		</p></div><div class="refsect1" lang="en"><a name="gluBuild1DMipmaps.3G-notes"/><h2>Notes</h2><p>
			Note that there is no direct way of querying the maximum level. This can be derived indirectly via <tt>glGetTexLevelParameter</tt>. First, query for the width actually used at level 0. (The width
			may not be equal to <i><tt>width</tt></i> since proxy textures might have scaled it to fit the implementation.)
			Then the maximum level can be derived from the formula <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:msub>
						<mml:mo>log</mml:mo>
						<mml:mn>2</mml:mn>
					</mml:msub>
					<mml:mi>width</mml:mi>
				</mml:math>.
		</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, and if the GLU version is 1.3 or greater.
		</p></div><div class="refsect1" lang="en"><a name="gluBuild1DMipmaps.3G-errors"/><h2>Errors</h2><p>
			<tt>GLU_INVALID_VALUE</tt> is returned if <i><tt>width</tt></i> is &lt; 1.
		</p><p>
			<tt>GLU_INVALID_ENUM</tt> is returned if <i><tt>format</tt></i> or <i><tt>type</tt></i> are
			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="gluBuild1DMipmaps.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="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="gluBuild2DMipmapLevels.3G.xml">gluBuild2DMipmapLevels</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="gluBuild1DMipmapLevels.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="gluBuild2DMipmapLevels.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gluBuild1DMipmapLevels </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> gluBuild2DMipmapLevels</td></tr></table></div></body></html>
