_C_ License Applicability. Except to the extent portions of this file are
_C_ made subject to an alternative license as permitted in the SGI Free
_C_ Software License B, Version 1.1 (the "License"), the contents of this
_C_ file are subject only to the provisions of the License. You may not use
_C_ this file except in compliance with the License. You may obtain a copy
_C_ of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
_C_ Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
_C_ 
_C_ http://oss.sgi.com/projects/FreeB
_C_ 
_C_ Note that, as provided in the License, the Software is distributed on an
_C_ "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
_C_ DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
_C_ CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
_C_ PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
_C_ 
_C_ Original Code. The Original Code is: OpenGL Sample Implementation,
_C_ Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
_C_ Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
_C_ Copyright in any portions created by third parties is as indicated
_C_ elsewhere herein. All Rights Reserved.
_C_ 
_C_ Additional Notice Provisions: The application programming interfaces
_C_ established by SGI in conjunction with the Original Code are The
_C_ OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
_C_ April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
_C_ 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
_C_ Window System(R) (Version 1.3), released October 19, 1998. This software
_C_ was created using the OpenGL(R) version 1.2.1 Sample Implementation
_C_ published by SGI, but has not been independently verified as being
_C_ compliant with the OpenGL(R) version 1.2.1 Specification.
_C_
_C_ The first character in this file must be an '_'!
_C_ Anything on a line after _C_ is ignored
_define(_filters,eqn)_C_
_C_      eqn is automatically replaced with neqn for nroff
_header(Build2DMipmapLevels, builds a subset of two-dimensional mipmap levels)
_names(Build2DMipmapLevels)
.EQ
delim $$
.EN
.SH PARAMETERS
_phead(_param1)
Specifies the target texture.  Must be _const(TEXTURE_2D).
_phead(_param2)
Requests the internal storage format of the texture image.  The most
current version of the SGI implementation of GLU does not check this
value for validity before passing it on to the underlying OpenGL
implementation.  A value that is not accepted by the OpenGL
implementation will lead to an OpenGL error.  The benefit of not
checking this value at the GLU level is that OpenGL extensions can add
new internal texture formats without requiring a revision of the GLU
implementation.  Older implementations of GLU check this value and
raise a GLU error if it is not 1, 2, 3, or 4 or one of the following
symbolic constants:
_const(ALPHA),
_const(ALPHA4),
_const(ALPHA8),
_const(ALPHA12),
_const(ALPHA16),
_const(LUMINANCE),
_const(LUMINANCE4),
_const(LUMINANCE8),
_const(LUMINANCE12),
_const(LUMINANCE16),
_const(LUMINANCE_ALPHA),
_const(LUMINANCE4_ALPHA4),
_const(LUMINANCE6_ALPHA2),
_const(LUMINANCE8_ALPHA8),
_const(LUMINANCE12_ALPHA4),
_const(LUMINANCE12_ALPHA12),
_const(LUMINANCE16_ALPHA16),
_const(INTENSITY),
_const(INTENSITY4),
_const(INTENSITY8),
_const(INTENSITY12),
_const(INTENSITY16),
_const(RGB),
_const(R3_G3_B2),
_const(RGB4),
_const(RGB5),
_const(RGB8),
_const(RGB10),
_const(RGB12),
_const(RGB16),
_const(RGBA),
_const(RGBA2),
_const(RGBA4),
_const(RGB5_A1),
_const(RGBA8),
_const(RGB10_A2),
_const(RGBA12) or
_const(RGBA16).
_phead(_param3 _param4)
Specifies the width and height, respectively, in pixels of the texture image. 
These should be a power of 2.
_phead(_param5)
Specifies the format of the pixel data.
Must be one of
_const(COLOR_INDEX),
_const(DEPTH_COMPONENT),
_const(RED),
_const(GREEN),
_const(BLUE),
_const(ALPHA),
_const(RGB),
_const(RGBA),
_const(BGR),
_const(BGRA),
_const(LUMINANCE), or
_const(LUMINANCE_ALPHA).
_phead(_param6)
Specifies the data type for _param10.
Must be one of
_const(UNSIGNED_BYTE),
_const(BYTE),
_const(BITMAP),
_const(UNSIGNED_SHORT),
_const(SHORT),
_const(UNSIGNED_INT),
_const(INT), 
_const(FLOAT), 
_const(UNSIGNED_BYTE_3_3_2),
_const(UNSIGNED_BYTE_2_3_3_REV),
_const(UNSIGNED_SHORT_5_6_5),
_const(UNSIGNED_SHORT_5_6_5_REV),
_const(UNSIGNED_SHORT_4_4_4_4),
_const(UNSIGNED_SHORT_4_4_4_4_REV),
_const(UNSIGNED_SHORT_5_5_5_1),
_const(UNSIGNED_SHORT_1_5_5_5_REV),
_const(UNSIGNED_INT_8_8_8_8),
_const(UNSIGNED_INT_8_8_8_8_REV),
_const(UNSIGNED_INT_10_10_10_2) or
_const(UNSIGNED_INT_2_10_10_10_REV).
_phead(_param7)
Specifies the mipmap level of the image data.
_phead(_param8)
Specifies the minimum mipmap level to pass to _glcmnd(TexImage2D).
_phead(_param9)
Specifies the maximum mipmap level to pass to _glcmnd(TexImage2D).
_phead(_param10)
Specifies a pointer to the image data in memory.
.SH DESCRIPTION
_cmnd 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
A return value of zero indicates success, otherwise a GLU error code is
returned (see _cmnd(ErrorString)).
.P
A series of mipmap levels from _param8 to _param9 is built by decimating 
_param10 in half along
both dimensions until size $1 ~times~ 1$ 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 $N ~times~ 1$ or $1 ~times~ N$ configuration. Here, two texels are
averaged instead.)
_glcmnd(TexImage2D) is called to load these mipmap levels from _param8
to _param9. If _param9 is larger than the highest mipmap level for the
texture of the specified size, then a GLU error code is returned (see
_cmnd(ErrorString)) and nothing is loaded.
.P
For example, if _param7 is 2 and _param3 is 16 and _param4 is 8, the
following levels are possible: $16 ~times~ 8$, $8 ~times~ 4$, $4 ~times~ 2$,
$2 ~times~ 1$, $1 ~times~ 1$. These correspond to levels 2 through 6
respectively.  If _param8 is 3 and _param9 is 5, then only mipmap levels
$8 ~times~ 4$, $4 ~times~ 2$ and $2 ~times~ 1$ are loaded. However, if _param9
is 7 then an error is returned and nothing is loaded since _param9 is
larger than the highest mipmap level which is, in this case, 6.
.P
The highest mipmap level can be derived from the formula
log2(max(_param3,_param4)*(2^_param7)).
.P
See the _glcmnd(TexImage1D) reference page for a description of the
acceptable values for _param5 parameter. See the _glcmnd(DrawPixels) 
reference page for a description of the acceptable values 
for _param6 parameter.
.SH NOTES
_cmnd is only available if the GLU version is 1.3 or greater.
.P
Formats _const(BGR), and _const(BGRA), and types 
_const(UNSIGNED_BYTE_3_3_2),
_const(UNSIGNED_BYTE_2_3_3_REV),
_const(UNSIGNED_SHORT_5_6_5),
_const(UNSIGNED_SHORT_5_6_5_REV),
_const(UNSIGNED_SHORT_4_4_4_4),
_const(UNSIGNED_SHORT_4_4_4_4_REV),
_const(UNSIGNED_SHORT_5_5_5_1),
_const(UNSIGNED_SHORT_1_5_5_5_REV),
_const(UNSIGNED_INT_8_8_8_8),
_const(UNSIGNED_INT_8_8_8_8_REV),
_const(UNSIGNED_INT_10_10_10_2), and
_const(UNSIGNED_INT_2_10_10_10_REV) are only available if the GL version 
is 1.2 or greater.
.SH ERRORS
_gluconst(INVALID_VALUE) is returned if _param7 > _param8, _param8 < 0,
_param9 < _param8 or _param9 is > the highest mipmap level for _param10.
.P
_gluconst(INVALID_VALUE) is returned if _param3 or _param4 is < 1.
.P
_gluconst(INVALID_ENUM) is returned if _param2, _param5, or _param6 is not 
legal.
.P
_gluconst(INVALID_OPERATION) is returned if _param6 is _const(UNSIGNED_BYTE_3_3_2) or _const(UNSIGNED_BYTE_2_3_3_REV)
and _param5 is not _const(RGB).
.P
_gluconst(INVALID_OPERATION) is returned if _param6 is _const(UNSIGNED_SHORT_5_6_5) or _const(UNSIGNED_SHORT_5_6_5_REV)
and _param5 is not _const(RGB).
.P
_gluconst(INVALID_OPERATION) is returned if _param6 is _const(UNSIGNED_SHORT_4_4_4_4) or _const(UNSIGNED_SHORT_4_4_4_4_REV)
and _param5 is neither _const(RGBA) nor _const(BGRA).
.P
_gluconst(INVALID_OPERATION) is returned if _param6 is _const(UNSIGNED_SHORT_5_5_5_1) or _const(UNSIGNED_SHORT_1_5_5_5_REV)
and _param5 is neither _const(RGBA) nor _const(BGRA).
.P
_gluconst(INVALID_OPERATION) is returned if _param6 is _const(UNSIGNED_INT_8_8_8_8) or _const(UNSIGNED_INT_8_8_8_8_REV)
and _param5 is neither _const(RGBA) nor _const(BGRA).
.P
_gluconst(INVALID_OPERATION) is returned if _param6 is _const(UNSIGNED_INT_10_10_10_2) or _const(UNSIGNED_INT_2_10_10_10_REV)
and _param5 is neither _const(RGBA) nor _const(BGRA).
.SH SEE ALSO
_glcmnd(DrawPixels),
_glcmnd(TexImage1D),
_glcmnd(TexImage2D), 
_glcmnd(TexImage3D),
_cmnd(Build1DMipmaps),
_cmnd(Build2DMipmaps),
_cmnd(Build3DMipmaps), 
_cmnd(ErrorString), 
_glcmnd(GetTexImage),
_glcmnd(GetTexLevelParameter),
_cmnd(Build1DMipmapLevels),
_cmnd(Build3DMipmapLevels)
