Opentk/Source/Bind/Specifications/Docs/GL/gluBuild3DMipmaps.xml

434 lines
22 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
"http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
<refentry id="gluBuild3DMipmaps">
<refmeta>
<refmetainfo>
<copyright>
<year>1991-2006</year>
<holder>Silicon Graphics, Inc.</holder>
</copyright>
</refmetainfo>
<refentrytitle>gluBuild3DMipmaps</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refname>gluBuild3DMipmaps</refname>
<refpurpose>builds a three-dimensional mipmap</refpurpose>
</refnamediv>
<refsynopsisdiv><title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>GLint <function>gluBuild3DMipmaps</function></funcdef>
<paramdef>GLenum <parameter>target</parameter></paramdef>
<paramdef>GLint <parameter>internalFormat</parameter></paramdef>
<paramdef>GLsizei <parameter>width</parameter></paramdef>
<paramdef>GLsizei <parameter>height</parameter></paramdef>
<paramdef>GLsizei <parameter>depth</parameter></paramdef>
<paramdef>GLenum <parameter>format</parameter></paramdef>
<paramdef>GLenum <parameter>type</parameter></paramdef>
<paramdef>const void * <parameter>data</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<!-- eqn: ignoring delim $$ -->
<refsect1 id="parameters"><title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>target</parameter></term>
<listitem>
<para>
Specifies the target texture. Must be <constant>GLU_TEXTURE_3D</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>internalFormat</parameter></term>
<listitem>
<para>
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:
<constant>GLU_ALPHA</constant>,
<constant>GLU_ALPHA4</constant>,
<constant>GLU_ALPHA8</constant>,
<constant>GLU_ALPHA12</constant>,
<constant>GLU_ALPHA16</constant>,
<constant>GLU_LUMINANCE</constant>,
<constant>GLU_LUMINANCE4</constant>,
<constant>GLU_LUMINANCE8</constant>,
<constant>GLU_LUMINANCE12</constant>,
<constant>GLU_LUMINANCE16</constant>,
<constant>GLU_LUMINANCE_ALPHA</constant>,
<constant>GLU_LUMINANCE4_ALPHA4</constant>,
<constant>GLU_LUMINANCE6_ALPHA2</constant>,
<constant>GLU_LUMINANCE8_ALPHA8</constant>,
<constant>GLU_LUMINANCE12_ALPHA4</constant>,
<constant>GLU_LUMINANCE12_ALPHA12</constant>,
<constant>GLU_LUMINANCE16_ALPHA16</constant>,
<constant>GLU_INTENSITY</constant>,
<constant>GLU_INTENSITY4</constant>,
<constant>GLU_INTENSITY8</constant>,
<constant>GLU_INTENSITY12</constant>,
<constant>GLU_INTENSITY16</constant>,
<constant>GLU_RGB</constant>,
<constant>GLU_R3_G3_B2</constant>,
<constant>GLU_RGB4</constant>,
<constant>GLU_RGB5</constant>,
<constant>GLU_RGB8</constant>,
<constant>GLU_RGB10</constant>,
<constant>GLU_RGB12</constant>,
<constant>GLU_RGB16</constant>,
<constant>GLU_RGBA</constant>,
<constant>GLU_RGBA2</constant>,
<constant>GLU_RGBA4</constant>,
<constant>GLU_RGB5_A1</constant>,
<constant>GLU_RGBA8</constant>,
<constant>GLU_RGB10_A2</constant>,
<constant>GLU_RGBA12</constant>, or
<constant>GLU_RGBA16</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>width</parameter></term>
<term><parameter>height</parameter></term>
<term><parameter>depth</parameter></term>
<listitem>
<para>
Specifies in pixels the width, height and depth respectively, in pixels
of the texture image.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>format</parameter></term>
<listitem>
<para>
Specifies the format of the pixel data.
Must be one of
<constant>GLU_COLOR_INDEX</constant>,
<constant>GLU_DEPTH_COMPONENT</constant>,
<constant>GLU_RED</constant>,
<constant>GLU_GREEN</constant>,
<constant>GLU_BLUE</constant>,
<constant>GLU_ALPHA</constant>,
<constant>GLU_RGB</constant>,
<constant>GLU_RGBA</constant>,
<constant>GLU_BGR</constant>,
<constant>GLU_BGRA</constant>,
<constant>GLU_LUMINANCE</constant>, or
<constant>GLU_LUMINANCE_ALPHA</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>
Specifies the data type for <parameter>data</parameter>.
Must be one of:
<constant>GLU_UNSIGNED_BYTE</constant>,
<constant>GLU_BYTE</constant>,
<constant>GLU_BITMAP</constant>,
<constant>GLU_UNSIGNED_SHORT</constant>,
<constant>GLU_SHORT</constant>,
<constant>GLU_UNSIGNED_INT</constant>,
<constant>GLU_INT</constant>,
<constant>GLU_FLOAT</constant>,
<constant>GLU_UNSIGNED_BYTE_3_3_2</constant>,
<constant>GLU_UNSIGNED_BYTE_2_3_3_REV</constant>,
<constant>GLU_UNSIGNED_SHORT_5_6_5</constant>,
<constant>GLU_UNSIGNED_SHORT_5_6_5_REV</constant>,
<constant>GLU_UNSIGNED_SHORT_4_4_4_4</constant>,
<constant>GLU_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
<constant>GLU_UNSIGNED_SHORT_5_5_5_1</constant>,
<constant>GLU_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
<constant>GLU_UNSIGNED_INT_8_8_8_8</constant>,
<constant>GLU_UNSIGNED_INT_8_8_8_8_REV</constant>,
<constant>GLU_UNSIGNED_INT_10_10_10_2</constant>, or
<constant>GLU_UNSIGNED_INT_2_10_10_10_REV</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
Specifies a pointer to the image data in memory.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="description"><title>Description</title>
<para>
<function>gluBuild3DMipmaps</function> builds a series of prefiltered three-dimensional texture maps of
decreasing resolutions called a mipmap. This is used for the antialiasing of
texture-mapped primitives.
</para>
<para>
A return value of zero indicates success, otherwise a GLU error code is
returned (see <citerefentry><refentrytitle>gluErrorString</refentrytitle></citerefentry>).
</para>
<para>
Initially, the <parameter>width</parameter>, <parameter>height</parameter> and <parameter>depth</parameter> of <parameter>data</parameter> are checked to
see if they are a power of 2. If not, a copy of <parameter>data</parameter> is made and
scaled up or down to the nearest power of 2. (If <parameter>width</parameter>, <parameter>height</parameter>, or
<parameter>depth</parameter> is exactly between powers of 2, then the copy of <parameter>data</parameter> will
scale upwards.) This copy will be used for subsequent mipmapping
operations described below. For example, if <parameter>width</parameter> is 57, <parameter>height</parameter> is
23, and <parameter>depth</parameter> is 24, then a copy of <parameter>data</parameter> will scale up to 64 in
width, down to 16 in height, and up to 32 in depth before mipmapping
takes place.
</para>
<para>
Then, proxy textures (see <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>) are used to determine if
the implementation can fit the requested texture. If not, all three dimensions
are continually halved until it fits.
</para>
<para>
Next, a series of mipmap levels is built by decimating a copy of <parameter>data</parameter>
in half along all three dimensions until size
<inlineequation><mml:math>
<!-- eqn: 1 times 1 times 1:-->
<mml:mrow>
<mml:mn>1</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>1</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:math></inlineequation>
is
reached. At each level, each texel in the halved mipmap level is an
average of the corresponding eight texels in the larger mipmap
level. (If exactly one of the dimensions is 1, four texels are averaged.
If exactly two of the dimensions are 1, two texels are averaged.)
</para>
<para>
<citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry> is called to load each of these mipmap levels.
Level 0 is a copy of <parameter>data</parameter>. The highest level is
<inlineequation><mml:math>
<!-- eqn: {log sub 2} ( max (width,height,depth)):-->
<mml:mrow>
<mml:mfenced open="" close="">
<mml:msub><mml:mi mathvariant="italic">log</mml:mi>
<mml:mn>2</mml:mn>
</mml:msub>
</mml:mfenced>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mi mathvariant="italic">max</mml:mi>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mi mathvariant="italic">width</mml:mi>
<mml:mi mathvariant="italic">height</mml:mi>
<mml:mi mathvariant="italic">depth</mml:mi>
</mml:mfenced>
</mml:mrow>
</mml:mfenced>
</mml:mrow>
</mml:math></inlineequation>.
For example, if <parameter>width</parameter> is 64, <parameter>height</parameter> is
16, and <parameter>depth</parameter> is 32, and the implementation can store a texture of this
size, the following mipmap levels are built:
<inlineequation><mml:math>
<!-- eqn: 64 times 16 times 32:-->
<mml:mrow>
<mml:mn>64</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>16</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>32</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
<inlineequation><mml:math>
<!-- eqn: 32 times 8 times 16:-->
<mml:mrow>
<mml:mn>32</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>8</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>16</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
<inlineequation><mml:math>
<!-- eqn: 16 times 4 times 8:-->
<mml:mrow>
<mml:mn>16</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>4</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>8</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
<inlineequation><mml:math>
<!-- eqn: 8 times 2 times 4:-->
<mml:mrow>
<mml:mn>8</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>2</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>4</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
<inlineequation><mml:math>
<!-- eqn: 4 times 1 times 2:-->
<mml:mrow>
<mml:mn>4</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>1</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
<inlineequation><mml:math>
<!-- eqn: 2 times 1 times 1:-->
<mml:mrow>
<mml:mn>2</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>1</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
and
<inlineequation><mml:math>
<!-- eqn: 1 times 1 times 1:-->
<mml:mrow>
<mml:mn>1</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>1</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:math></inlineequation>.
These correspond
to levels 0 through 6, respectively.
</para>
<para>
See the <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry> reference page for a description of the
acceptable values for <parameter>format</parameter> parameter. See the <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>
reference page for a description of the acceptable values
for <parameter>type</parameter> parameter.
</para>
</refsect1>
<refsect1 id="notes"><title>Notes</title>
<para>
Note that there is no direct way of querying the maximum level. This can
be derived indirectly via <citerefentry><refentrytitle>glGetTexLevelParameter</refentrytitle></citerefentry>. First, query
the width, height, and depth actually used at level 0. (The width,
height, and depth may not be equal to <parameter>width</parameter>, <parameter>height</parameter>, and <parameter>depth</parameter>
respectively since proxy textures might have scaled them to fit the
implementation.) Then the maximum level can be derived from the formula
<inlineequation><mml:math>
<!-- eqn: {log sub 2} ( max (width,height,depth)):-->
<mml:mrow>
<mml:mfenced open="" close="">
<mml:msub><mml:mi mathvariant="italic">log</mml:mi>
<mml:mn>2</mml:mn>
</mml:msub>
</mml:mfenced>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mi mathvariant="italic">max</mml:mi>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mi mathvariant="italic">width</mml:mi>
<mml:mi mathvariant="italic">height</mml:mi>
<mml:mi mathvariant="italic">depth</mml:mi>
</mml:mfenced>
</mml:mrow>
</mml:mfenced>
</mml:mrow>
</mml:math></inlineequation>.
</para>
<para>
<function>gluBuild3DMipmaps</function> is only available if the GLU version is 1.3 or greater.
</para>
<para>
Formats <constant>GLU_BGR</constant>, and <constant>GLU_BGRA</constant>, and types
<constant>GLU_UNSIGNED_BYTE_3_3_2</constant>,
<constant>GLU_UNSIGNED_BYTE_2_3_3_REV</constant>,
<constant>GLU_UNSIGNED_SHORT_5_6_5</constant>,
<constant>GLU_UNSIGNED_SHORT_5_6_5_REV</constant>,
<constant>GLU_UNSIGNED_SHORT_4_4_4_4</constant>,
<constant>GLU_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
<constant>GLU_UNSIGNED_SHORT_5_5_5_1</constant>,
<constant>GLU_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
<constant>GLU_UNSIGNED_INT_8_8_8_8</constant>,
<constant>GLU_UNSIGNED_INT_8_8_8_8_REV</constant>,
<constant>GLU_UNSIGNED_INT_10_10_10_2</constant>, and
<constant>GLU_UNSIGNED_INT_2_10_10_10_REV</constant> are only available if the GL version
is 1.2 or greater.
</para>
</refsect1>
<refsect1 id="errors"><title>Errors</title>
<para>
<constant>GLU_INVALID_VALUE</constant> is returned if <parameter>width</parameter>, <parameter>height</parameter>, or <parameter>depth</parameter> is &lt; 1.
</para>
<para>
<constant>GLU_INVALID_ENUM</constant> is returned if <parameter>internalFormat</parameter>, <parameter>format</parameter>, or <parameter>type</parameter> is not
legal.
</para>
<para>
<constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_BYTE_3_3_2</constant> or <constant>GLU_UNSIGNED_BYTE_2_3_3_REV</constant>
and <parameter>format</parameter> is not <constant>GLU_RGB</constant>.
</para>
<para>
<constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_SHORT_5_6_5</constant> or <constant>GLU_UNSIGNED_SHORT_5_6_5_REV</constant>
and <parameter>format</parameter> is not <constant>GLU_RGB</constant>.
</para>
<para>
<constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_SHORT_4_4_4_4</constant> or <constant>GLU_UNSIGNED_SHORT_4_4_4_4_REV</constant>
and <parameter>format</parameter> is neither <constant>GLU_RGBA</constant> nor <constant>GLU_BGRA</constant>.
</para>
<para>
<constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_SHORT_5_5_5_1</constant> or <constant>GLU_UNSIGNED_SHORT_1_5_5_5_REV</constant>
and <parameter>format</parameter> is neither <constant>GLU_RGBA</constant> nor <constant>GLU_BGRA</constant>.
</para>
<para>
<constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_INT_8_8_8_8</constant> or <constant>GLU_UNSIGNED_INT_8_8_8_8_REV</constant>
and <parameter>format</parameter> is neither <constant>GLU_RGBA</constant> nor <constant>GLU_BGRA</constant>.
</para>
<para>
<constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_INT_10_10_10_2</constant> or <constant>GLU_UNSIGNED_INT_2_10_10_10_REV</constant>
and <parameter>format</parameter> is neither <constant>GLU_RGBA</constant> nor <constant>GLU_BGRA</constant>.
</para>
</refsect1>
<refsect1 id="seealso"><title>See Also</title>
<para>
<citerefentry><refentrytitle>gluBuild1DMipmapLevels</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>gluBuild1DMipmaps</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>gluBuild2DMipmapLevels</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>gluBuild3DMipmapLevels</refentrytitle></citerefentry>,
<function>gluBuild3DMipmaps</function>,
<citerefentry><refentrytitle>gluErrorString</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glGetTexImage</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glGetTexLevelParameter</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>
</para>
</refsect1>
<refsect1 id="Copyright"><title>Copyright</title>
<para>
Copyright <trademark class="copyright"></trademark> 1991-2006
Silicon Graphics, Inc. This document is licensed under the SGI
Free Software B License. For details, see
<ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
</para>
</refsect1>
</refentry>