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

438 lines
22 KiB
XML
Raw Normal View History

<?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="gluBuild2DMipmapLevels">
<refmeta>
<refmetainfo>
<copyright>
<year>1991-2006</year>
<holder>Silicon Graphics, Inc.</holder>
</copyright>
</refmetainfo>
<refentrytitle>gluBuild2DMipmapLevels</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refname>gluBuild2DMipmapLevels</refname>
<refpurpose>builds a subset of two-dimensional mipmap levels</refpurpose>
</refnamediv>
<refsynopsisdiv><title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>GLint <function>gluBuild2DMipmapLevels</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>GLenum <parameter>format</parameter></paramdef>
<paramdef>GLenum <parameter>type</parameter></paramdef>
<paramdef>GLint <parameter>level</parameter></paramdef>
<paramdef>GLint <parameter>base</parameter></paramdef>
<paramdef>GLint <parameter>max</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_2D</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>
<listitem>
<para>
Specifies the width and height, respectively, in pixels of the texture image.
These should be a power of 2.
</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>level</parameter></term>
<listitem>
<para>
Specifies the mipmap level of the image data.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>base</parameter></term>
<listitem>
<para>
Specifies the minimum mipmap level to pass to <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>max</parameter></term>
<listitem>
<para>
Specifies the maximum mipmap level to pass to <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>.
</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>gluBuild2DMipmapLevels</function> 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.
</para>
<para>
A return value of zero indicates success, otherwise a GLU error code is
returned (see <citerefentry><refentrytitle>gluErrorString</refentrytitle></citerefentry>).
</para>
<para>
A series of mipmap levels from <parameter>base</parameter> to <parameter>max</parameter> is built by decimating
<parameter>data</parameter> in half along
both dimensions until size
<inlineequation><mml:math>
<!-- eqn: 1 times 1:-->
<mml:mrow>
<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 four texels in the larger
mipmap level. (In the case of rectangular images, the decimation will ultimately
reach an
<inlineequation><mml:math>
<!-- eqn: N times 1:-->
<mml:mrow>
<mml:mi mathvariant="italic">N</mml:mi>
<mml:mo>&times;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:math></inlineequation>
or
<inlineequation><mml:math>
<!-- eqn: 1 times N:-->
<mml:mrow>
<mml:mn>1</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mi mathvariant="italic">N</mml:mi>
</mml:mrow>
</mml:math></inlineequation>
configuration. Here, two texels are
averaged instead.)
<citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry> is called to load these mipmap levels from <parameter>base</parameter>
to <parameter>max</parameter>. If <parameter>max</parameter> is larger than the highest mipmap level for the
texture of the specified size, then a GLU error code is returned (see
<citerefentry><refentrytitle>gluErrorString</refentrytitle></citerefentry>) and nothing is loaded.
</para>
<para>
For example, if <parameter>level</parameter> is 2 and <parameter>width</parameter> is 16 and <parameter>height</parameter> is 8, the
following levels are possible:
<inlineequation><mml:math>
<!-- eqn: 16 times 8:-->
<mml:mrow>
<mml:mn>16</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>8</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
<inlineequation><mml:math>
<!-- eqn: 8 times 4:-->
<mml:mrow>
<mml:mn>8</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>4</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
<inlineequation><mml:math>
<!-- eqn: 4 times 2:-->
<mml:mrow>
<mml:mn>4</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
<inlineequation><mml:math>
<!-- eqn: 2 times 1:-->
<mml:mrow>
<mml:mn>2</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
<inlineequation><mml:math>
<!-- eqn: 1 times 1:-->
<mml:mrow>
<mml:mn>1</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:math></inlineequation>.
These correspond to levels 2 through 6
respectively. If <parameter>base</parameter> is 3 and <parameter>max</parameter> is 5, then only mipmap levels
<inlineequation><mml:math>
<!-- eqn: 8 times 4:-->
<mml:mrow>
<mml:mn>8</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>4</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
<inlineequation><mml:math>
<!-- eqn: 4 times 2:-->
<mml:mrow>
<mml:mn>4</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:math></inlineequation>,
and
<inlineequation><mml:math>
<!-- eqn: 2 times 1:-->
<mml:mrow>
<mml:mn>2</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:math></inlineequation>
are loaded. However, if <parameter>max</parameter>
is 7, then an error is returned and nothing is loaded since <parameter>max</parameter> is
larger than the highest mipmap level which is, in this case, 6.
</para>
<para>
The highest mipmap level can be derived from the formula
<inlineequation><mml:math>
<!-- eqn: log sub 2 (max(width,height) * 2 sup level):-->
<mml:mrow>
<mml:msub><mml:mi mathvariant="italic">log</mml:mi>
<mml:mn>2</mml:mn>
</mml:msub>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mrow>
<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:mfenced>
</mml:mrow>
<mml:mo>&times;</mml:mo>
<mml:msup><mml:mn>2</mml:mn>
<mml:mi mathvariant="italic">level</mml:mi>
</mml:msup>
</mml:mrow>
</mml:mfenced>
</mml:mrow>
</mml:math></inlineequation>.
</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>
<function>gluBuild2DMipmapLevels</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>level</parameter> &gt; <parameter>base</parameter>, <parameter>base</parameter> &lt; 0,
<parameter>max</parameter> &lt; <parameter>base</parameter>, or <parameter>max</parameter> is &gt; the highest mipmap level for <parameter>data</parameter>.
</para>
<para>
<constant>GLU_INVALID_VALUE</constant> is returned if <parameter>width</parameter> or <parameter>height</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>gluBuild2DMipmaps</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>gluBuild3DMipmapLevels</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>gluBuild3DMipmaps</refentrytitle></citerefentry>,
<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>