Opentk/Source/Bind/Specifications/Docs/glTexImage3D.xml
2009-03-08 00:46:58 +00:00

941 lines
48 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="glTexImage3D">
<refmeta>
<refmetainfo>
<copyright>
<year>1991-2006</year>
<holder>Silicon Graphics, Inc.</holder>
</copyright>
</refmetainfo>
<refentrytitle>glTexImage3D</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refname>glTexImage3D</refname>
<refpurpose>specify a three-dimensional texture image</refpurpose>
</refnamediv>
<refsynopsisdiv><title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>glTexImage3D</function></funcdef>
<paramdef>GLenum <parameter>target</parameter></paramdef>
<paramdef>GLint <parameter>level</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>GLint <parameter>border</parameter></paramdef>
<paramdef>GLenum <parameter>format</parameter></paramdef>
<paramdef>GLenum <parameter>type</parameter></paramdef>
<paramdef>const GLvoid * <parameter>data</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<!-- eqn: ignoring delim $$ -->
<para>
</para>
<refsect1 id="parameters"><title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>target</parameter></term>
<listitem>
<para>
Specifies the target texture.
Must be <constant>GL_TEXTURE_3D</constant> or <constant>GL_PROXY_TEXTURE_3D</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>level</parameter></term>
<listitem>
<para>
Specifies the level-of-detail number.
Level 0 is the base image level.
Level
<inlineequation><mml:math><mml:mi mathvariant="italic">n</mml:mi></mml:math></inlineequation>
is the
<inlineequation><mml:math>
<!-- eqn: n sup th:-->
<mml:msup><mml:mi mathvariant="italic">n</mml:mi>
<mml:mi mathvariant="italic">th</mml:mi>
</mml:msup>
</mml:math></inlineequation>
mipmap reduction image.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>internalFormat</parameter></term>
<listitem>
<para>
Specifies the number of color components in the texture.
Must be 1, 2, 3, or 4, or one of the following symbolic constants:
<constant>GL_ALPHA</constant>,
<constant>GL_ALPHA4</constant>,
<constant>GL_ALPHA8</constant>,
<constant>GL_ALPHA12</constant>,
<constant>GL_ALPHA16</constant>,
<constant>GL_COMPRESSED_ALPHA</constant>,
<constant>GL_COMPRESSED_LUMINANCE</constant>,
<constant>GL_COMPRESSED_LUMINANCE_ALPHA</constant>,
<constant>GL_COMPRESSED_INTENSITY</constant>,
<constant>GL_COMPRESSED_RGB</constant>,
<constant>GL_COMPRESSED_RGBA</constant>,
<constant>GL_LUMINANCE</constant>,
<constant>GL_LUMINANCE4</constant>,
<constant>GL_LUMINANCE8</constant>,
<constant>GL_LUMINANCE12</constant>,
<constant>GL_LUMINANCE16</constant>,
<constant>GL_LUMINANCE_ALPHA</constant>,
<constant>GL_LUMINANCE4_ALPHA4</constant>,
<constant>GL_LUMINANCE6_ALPHA2</constant>,
<constant>GL_LUMINANCE8_ALPHA8</constant>,
<constant>GL_LUMINANCE12_ALPHA4</constant>,
<constant>GL_LUMINANCE12_ALPHA12</constant>,
<constant>GL_LUMINANCE16_ALPHA16</constant>,
<constant>GL_INTENSITY</constant>,
<constant>GL_INTENSITY4</constant>,
<constant>GL_INTENSITY8</constant>,
<constant>GL_INTENSITY12</constant>,
<constant>GL_INTENSITY16</constant>,
<constant>GL_R3_G3_B2</constant>,
<constant>GL_RGB</constant>,
<constant>GL_RGB4</constant>,
<constant>GL_RGB5</constant>,
<constant>GL_RGB8</constant>,
<constant>GL_RGB10</constant>,
<constant>GL_RGB12</constant>,
<constant>GL_RGB16</constant>,
<constant>GL_RGBA</constant>,
<constant>GL_RGBA2</constant>,
<constant>GL_RGBA4</constant>,
<constant>GL_RGB5_A1</constant>,
<constant>GL_RGBA8</constant>,
<constant>GL_RGB10_A2</constant>,
<constant>GL_RGBA12</constant>,
<constant>GL_RGBA16</constant>,
<constant>GL_SLUMINANCE</constant>,
<constant>GL_SLUMINANCE8</constant>,
<constant>GL_SLUMINANCE_ALPHA</constant>,
<constant>GL_SLUMINANCE8_ALPHA8</constant>,
<constant>GL_SRGB</constant>,
<constant>GL_SRGB8</constant>,
<constant>GL_SRGB_ALPHA</constant>, or
<constant>GL_SRGB8_ALPHA8</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>width</parameter></term>
<listitem>
<para>
Specifies the width of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be
<inlineequation><mml:math>
<!-- eqn: 2 sup n + 2 ( border ):-->
<mml:mrow>
<mml:msup><mml:mn>2</mml:mn>
<mml:mi mathvariant="italic">n</mml:mi>
</mml:msup>
<mml:mo>+</mml:mo>
<mml:mrow>
<mml:mn>2</mml:mn>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mi mathvariant="italic">border</mml:mi>
</mml:mfenced>
</mml:mrow>
</mml:mrow>
</mml:math></inlineequation>
for some integer
<inlineequation><mml:math><mml:mi mathvariant="italic">n</mml:mi></mml:math></inlineequation>.
All
implementations support 3D texture images that are at least 16 texels
wide.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>height</parameter></term>
<listitem>
<para>
Specifies the height of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be
<inlineequation><mml:math>
<!-- eqn: 2 sup m + 2 ( border ):-->
<mml:mrow>
<mml:msup><mml:mn>2</mml:mn>
<mml:mi mathvariant="italic">m</mml:mi>
</mml:msup>
<mml:mo>+</mml:mo>
<mml:mrow>
<mml:mn>2</mml:mn>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mi mathvariant="italic">border</mml:mi>
</mml:mfenced>
</mml:mrow>
</mml:mrow>
</mml:math></inlineequation>
for some integer
<inlineequation><mml:math><mml:mi mathvariant="italic">m</mml:mi></mml:math></inlineequation>.
All
implementations support 3D texture images that are at least 16 texels
high.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>depth</parameter></term>
<listitem>
<para>
Specifies the depth of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be
<inlineequation><mml:math>
<!-- eqn: 2 sup k + 2 ( border ):-->
<mml:mrow>
<mml:msup><mml:mn>2</mml:mn>
<mml:mi mathvariant="italic">k</mml:mi>
</mml:msup>
<mml:mo>+</mml:mo>
<mml:mrow>
<mml:mn>2</mml:mn>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mi mathvariant="italic">border</mml:mi>
</mml:mfenced>
</mml:mrow>
</mml:mrow>
</mml:math></inlineequation>
for some integer
<inlineequation><mml:math><mml:mi mathvariant="italic">k</mml:mi></mml:math></inlineequation>.
All
implementations support 3D texture images that are at least 16 texels
deep.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>border</parameter></term>
<listitem>
<para>
Specifies the width of the border.
Must be either 0 or 1.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>format</parameter></term>
<listitem>
<para>
Specifies the format of the pixel data.
The following symbolic values are accepted:
<constant>GL_COLOR_INDEX</constant>,
<constant>GL_RED</constant>,
<constant>GL_GREEN</constant>,
<constant>GL_BLUE</constant>,
<constant>GL_ALPHA</constant>,
<constant>GL_RGB</constant>,
<constant>GL_BGR</constant>,
<constant>GL_RGBA</constant>,
<constant>GL_BGRA</constant>,
<constant>GL_LUMINANCE</constant>, and
<constant>GL_LUMINANCE_ALPHA</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>
Specifies the data type of the pixel data.
The following symbolic values are accepted:
<constant>GL_UNSIGNED_BYTE</constant>,
<constant>GL_BYTE</constant>,
<constant>GL_BITMAP</constant>,
<constant>GL_UNSIGNED_SHORT</constant>,
<constant>GL_SHORT</constant>,
<constant>GL_UNSIGNED_INT</constant>,
<constant>GL_INT</constant>,
<constant>GL_FLOAT</constant>,
<constant>GL_UNSIGNED_BYTE_3_3_2</constant>,
<constant>GL_UNSIGNED_BYTE_2_3_3_REV</constant>,
<constant>GL_UNSIGNED_SHORT_5_6_5</constant>,
<constant>GL_UNSIGNED_SHORT_5_6_5_REV</constant>,
<constant>GL_UNSIGNED_SHORT_4_4_4_4</constant>,
<constant>GL_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
<constant>GL_UNSIGNED_SHORT_5_5_5_1</constant>,
<constant>GL_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
<constant>GL_UNSIGNED_INT_8_8_8_8</constant>,
<constant>GL_UNSIGNED_INT_8_8_8_8_REV</constant>,
<constant>GL_UNSIGNED_INT_10_10_10_2</constant>, and
<constant>GL_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>
Texturing maps a portion of a specified texture image
onto each graphical primitive for which texturing is enabled.
To enable and disable three-dimensional texturing, call <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>
and <citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_3D</constant>.
</para>
<para>
To define texture images, call <function>glTexImage3D</function>.
The arguments describe the parameters of the texture image,
such as height,
width, depth,
width of the border,
level-of-detail number
(see <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry>),
and number of color components provided.
The last three arguments describe how the image is represented in memory;
they are identical to the pixel formats used for <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>.
</para>
<para>
If <parameter>target</parameter> is <constant>GL_PROXY_TEXTURE_3D</constant>, no data is read from <parameter>data</parameter>, but
all of the texture image state is recalculated, checked for
consistency, and checked
against the implementation's capabilities. If the implementation cannot
handle a texture of the requested texture size, it sets
all of the image state to 0,
but does not generate an error (see <citerefentry><refentrytitle>glGetError</refentrytitle></citerefentry>). To query for an
entire mipmap array, use an image array level greater than or equal to
1.
</para>
<para>
If <parameter>target</parameter> is <constant>GL_TEXTURE_3D</constant>,
data is read from <parameter>data</parameter> as a sequence of signed or unsigned bytes,
shorts,
or longs,
or single-precision floating-point values,
depending on <parameter>type</parameter>.
These values are grouped into sets of one,
two,
three,
or four values,
depending on <parameter>format</parameter>,
to form elements.
If <parameter>type</parameter> is <constant>GL_BITMAP</constant>,
the data is considered as a string of unsigned bytes (and
<parameter>format</parameter> must be <constant>GL_COLOR_INDEX</constant>).
Each data byte is treated as eight 1-bit elements,
with bit ordering determined by <constant>GL_UNPACK_LSB_FIRST</constant>
(see <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry>).
</para>
<para>
If a non-zero named buffer object is bound to the <constant>GL_PIXEL_UNPACK_BUFFER</constant> target
(see <citerefentry><refentrytitle>glBindBuffer</refentrytitle></citerefentry>) while a texture image is
specified, <parameter>data</parameter> is treated as a byte offset into the buffer object's data store.
</para>
<para>
The first element corresponds to the lower left corner of the texture
image.
Subsequent elements progress left-to-right through the remaining texels
in the lowest row of the texture image, and then in successively higher
rows of the texture image.
The final element corresponds to the upper right corner of the texture
image.
</para>
<para>
<parameter>format</parameter> determines the composition of each element in <parameter>data</parameter>.
It can assume one of these symbolic values:
</para>
<variablelist>
<varlistentry>
<term><constant>GL_COLOR_INDEX</constant></term>
<listitem>
<para>
Each element is a single value,
a color index.
The GL converts it to fixed point
(with an unspecified number of zero bits to the right of the binary point),
shifted left or right depending on the value and sign of <constant>GL_INDEX_SHIFT</constant>,
and added to <constant>GL_INDEX_OFFSET</constant>
(see <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>).
The resulting index is converted to a set of color components
using the
<constant>GL_PIXEL_MAP_I_TO_R</constant>,
<constant>GL_PIXEL_MAP_I_TO_G</constant>,
<constant>GL_PIXEL_MAP_I_TO_B</constant>, and
<constant>GL_PIXEL_MAP_I_TO_A</constant> tables,
and clamped to the range [0,1].
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_RED</constant></term>
<listitem>
<para>
Each element is a single red component.
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for green and blue, and 1 for alpha.
Each component is then multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
added to the signed bias <constant>GL_c_BIAS</constant>,
and clamped to the range [0,1]
(see <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_GREEN</constant></term>
<listitem>
<para>
Each element is a single green component.
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for red and blue, and 1 for alpha.
Each component is then multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
added to the signed bias <constant>GL_c_BIAS</constant>,
and clamped to the range [0,1]
(see <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_BLUE</constant></term>
<listitem>
<para>
Each element is a single blue component.
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for red and green, and 1 for alpha.
Each component is then multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
added to the signed bias <constant>GL_c_BIAS</constant>,
and clamped to the range [0,1]
(see <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_ALPHA</constant></term>
<listitem>
<para>
Each element is a single alpha component.
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for red, green, and blue.
Each component is then multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
added to the signed bias <constant>GL_c_BIAS</constant>,
and clamped to the range [0,1]
(see <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_INTENSITY</constant></term>
<listitem>
<para>
Each element is a single intensity value.
The GL converts it to floating point,
then assembles it into an RGBA element by replicating the intensity value
three times for red, green, blue, and alpha.
Each component is then multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
added to the signed bias <constant>GL_c_BIAS</constant>,
and clamped to the range [0,1]
(see <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_RGB</constant></term>
<listitem>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_BGR</constant></term>
<listitem>
<para>
Each element is an RGB triple.
The GL converts it to floating point and assembles it into an RGBA element
by attaching 1 for alpha.
Each component is then multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
added to the signed bias <constant>GL_c_BIAS</constant>,
and clamped to the range [0,1]
(see <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_RGBA</constant></term>
<listitem>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_BGRA</constant></term>
<listitem>
<para>
Each element contains all four components.
Each component is multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
added to the signed bias <constant>GL_c_BIAS</constant>,
and clamped to the range [0,1]
(see <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_LUMINANCE</constant></term>
<listitem>
<para>
Each element is a single luminance value.
The GL converts it to floating point,
then assembles it into an RGBA element by replicating the luminance value
three times for red, green, and blue and attaching 1 for alpha.
Each component is then multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
added to the signed bias <constant>GL_c_BIAS</constant>,
and clamped to the range [0,1]
(see <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_LUMINANCE_ALPHA</constant></term>
<listitem>
<para>
Each element is a luminance/alpha pair.
The GL converts it to floating point,
then assembles it into an RGBA element by replicating the luminance value
three times for red, green, and blue.
Each component is then multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
added to the signed bias <constant>GL_c_BIAS</constant>,
and clamped to the range [0,1] (see <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>).
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
Refer to the <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry> reference page for a description of
the acceptable values for the <parameter>type</parameter> parameter.
</para>
<para>
If an application wants to store the texture at a certain
resolution or in a certain format, it can request the resolution
and format with <parameter>internalFormat</parameter>. The GL will choose an internal
representation that closely approximates that requested by <parameter>internalFormat</parameter>, but
it may not match exactly.
(The representations specified by <constant>GL_LUMINANCE</constant>,
<constant>GL_LUMINANCE_ALPHA</constant>, <constant>GL_RGB</constant>,
and <constant>GL_RGBA</constant> must match exactly. The numeric values 1, 2, 3, and 4
may also be used to specify the above representations.)
</para>
<para>
If the <parameter>internalFormat</parameter> parameter is one of the generic compressed formats,
<constant>GL_COMPRESSED_ALPHA</constant>,
<constant>GL_COMPRESSED_INTENSITY</constant>,
<constant>GL_COMPRESSED_LUMINANCE</constant>,
<constant>GL_COMPRESSED_LUMINANCE_ALPHA</constant>,
<constant>GL_COMPRESSED_RGB</constant>, or
<constant>GL_COMPRESSED_RGBA</constant>, the GL will replace the internal format with the symbolic constant for a specific internal format and compress the texture before storage. If no corresponding internal format is available, or the GL can not compress that image for any reason, the internal format is instead replaced with a corresponding base internal format.
</para>
<para>
If the <parameter>internalFormat</parameter> parameter is
<constant>GL_SRGB</constant>,
<constant>GL_SRGB8</constant>,
<constant>GL_SRGB_ALPHA</constant>,
<constant>GL_SRGB8_ALPHA8</constant>,
<constant>GL_SLUMINANCE</constant>,
<constant>GL_SLUMINANCE8</constant>,
<constant>GL_SLUMINANCE_ALPHA</constant>, or
<constant>GL_SLUMINANCE8_ALPHA8</constant>, the texture is treated as if the red, green, blue, or luminance components are encoded in the sRGB color space. Any alpha component is left unchanged. The conversion from the sRGB encoded component
<inlineequation><mml:math>
<mml:msub><mml:mi mathvariant="italic">c</mml:mi>
<mml:mi mathvariant="italic">s</mml:mi>
</mml:msub>
</mml:math></inlineequation>
to a linear component
<inlineequation><mml:math>
<mml:msub><mml:mi mathvariant="italic">c</mml:mi>
<mml:mi mathvariant="italic">l</mml:mi>
</mml:msub>
</mml:math></inlineequation>
is:
</para>
<para>
<inlineequation><mml:math>
<mml:mrow>
<mml:msub>
<mml:mi mathvariant="italic">c</mml:mi>
<mml:mi mathvariant="italic">l</mml:mi>
</mml:msub>
<mml:mo>=</mml:mo>
<mml:mrow>
<mml:mo>{</mml:mo>
<mml:mtable columnalign="left">
<mml:mtr>
<mml:mtd columnalign="left">
<mml:mfrac>
<mml:msub>
<mml:mi mathvariant="italic">c</mml:mi>
<mml:mi mathvariant="italic">s</mml:mi>
</mml:msub>
<mml:mn>12.92</mml:mn>
</mml:mfrac>
</mml:mtd>
<mml:mtd columnalign="left">
<mml:mrow>
<mml:mspace width="1ex"/>
<mml:mo>if</mml:mo>
<mml:mspace width="1ex"/>
</mml:mrow>
<mml:msub>
<mml:mi mathvariant="italic">c</mml:mi>
<mml:mi mathvariant="italic">s</mml:mi>
</mml:msub>
<mml:mo>&le;</mml:mo>
<mml:mn>0.04045</mml:mn>
</mml:mtd>
</mml:mtr>
<mml:mtr>
<mml:mtd columnalign="left">
<mml:msup>
<mml:mrow>
<mml:mo>(</mml:mo>
<mml:mfrac>
<mml:mrow>
<mml:msub>
<mml:mi>c</mml:mi>
<mml:mi>s</mml:mi>
</mml:msub>
<mml:mo>+</mml:mo>
<mml:mn>0.055</mml:mn>
</mml:mrow>
<mml:mn>1.055</mml:mn>
</mml:mfrac>
<mml:mo>)</mml:mo>
</mml:mrow>
<mml:mn>2.4</mml:mn>
</mml:msup>
</mml:mtd>
<mml:mtd columnalign="left">
<mml:mrow>
<mml:mspace width="1ex"/>
<mml:mo>if</mml:mo>
<mml:mspace width="1ex"/>
</mml:mrow>
<mml:msub>
<mml:mi mathvariant="italic">c</mml:mi>
<mml:mi mathvariant="italic">s</mml:mi>
</mml:msub>
<mml:mo>&gt;</mml:mo>
<mml:mn>0.04045</mml:mn>
</mml:mtd>
</mml:mtr>
</mml:mtable>
</mml:mrow>
</mml:mrow>
</mml:math>
</inlineequation>
</para>
<para>
Assume
<inlineequation><mml:math>
<mml:msub><mml:mi mathvariant="italic">c</mml:mi>
<mml:mi mathvariant="italic">s</mml:mi>
</mml:msub>
</mml:math></inlineequation>
is the sRGB component in the range [0,1].
</para>
<para>
Use the <constant>GL_PROXY_TEXTURE_3D</constant> target to try out a resolution and
format. The implementation will
update and recompute its best match for the requested storage resolution
and format. To then query this state, call <citerefentry><refentrytitle>glGetTexLevelParameter</refentrytitle></citerefentry>.
If the texture cannot be accommodated, texture state is set to 0.
</para>
<para>
A one-component texture image uses only the red component of the RGBA
color extracted from <parameter>data</parameter>.
A two-component image uses the R and A values.
A three-component image uses the R, G, and B values.
A four-component image uses all of the RGBA components.
</para>
</refsect1>
<refsect1 id="notes"><title>Notes</title>
<para>
Texturing has no effect in color index mode.
</para>
<para>
The texture image can be represented by the same data formats
as the pixels in a <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry> command,
except that <constant>GL_STENCIL_INDEX</constant> and <constant>GL_DEPTH_COMPONENT</constant>
cannot be used.
<citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry> modes affect texture images
in exactly the way they affect <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>.
</para>
<para>
<function>glTexImage3D</function> is available only if the GL version is 1.2 or greater.
</para>
<para>
Internal formats other than 1, 2, 3, or 4 may be used only if the GL
version is 1.1 or greater.
</para>
<para>
<parameter>data</parameter> may be a null pointer.
In this case texture memory is
allocated to accommodate a texture of width <parameter>width</parameter>, height <parameter>height</parameter>,
and depth <parameter>depth</parameter>.
You can then download subtextures to initialize this
texture memory.
The image is undefined if the user tries to apply
an uninitialized portion of the texture image to a primitive.
</para>
<para>
Formats <constant>GL_BGR</constant>, and <constant>GL_BGRA</constant> and types
<constant>GL_UNSIGNED_BYTE_3_3_2</constant>,
<constant>GL_UNSIGNED_BYTE_2_3_3_REV</constant>,
<constant>GL_UNSIGNED_SHORT_5_6_5</constant>,
<constant>GL_UNSIGNED_SHORT_5_6_5_REV</constant>,
<constant>GL_UNSIGNED_SHORT_4_4_4_4</constant>,
<constant>GL_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
<constant>GL_UNSIGNED_SHORT_5_5_5_1</constant>,
<constant>GL_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
<constant>GL_UNSIGNED_INT_8_8_8_8</constant>,
<constant>GL_UNSIGNED_INT_8_8_8_8_REV</constant>,
<constant>GL_UNSIGNED_INT_10_10_10_2</constant>, and
<constant>GL_UNSIGNED_INT_2_10_10_10_REV</constant> are available only if the GL version
is 1.2 or greater.
</para>
<para>
For OpenGL versions 1.3 and greater, or when the <code>ARB_multitexture</code> extension is supported, <function>glTexImage3D</function>
specifies the three-dimensional texture for the current texture unit,
specified with <citerefentry><refentrytitle>glActiveTexture</refentrytitle></citerefentry>.
</para>
<para>
If the <code>ARB_imaging</code> extension is supported, RGBA elements may
also be processed by the imaging pipeline. The following stages may be
applied to an RGBA color before color component clamping to the range
<inlineequation><mml:math>
<!-- eqn: [0,1]:-->
<mml:mfenced open="[" close="]">
<mml:mn>0</mml:mn>
<mml:mn>1</mml:mn>
</mml:mfenced>
</mml:math></inlineequation>:
</para>
<variablelist>
<varlistentry>
<term>1. Color component replacement by the color table specified for</term>
<listitem>
<para>
<constant>GL_COLOR_TABLE</constant>, if enabled. See <citerefentry><refentrytitle>glColorTable</refentrytitle></citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>2. Color component replacement by the color table specified for</term>
<listitem>
<para>
<constant>GL_POST_CONVOLUTION_COLOR_TABLE</constant>, if enabled. See <citerefentry><refentrytitle>glColorTable</refentrytitle></citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>3. Transformation by the color matrix. See <citerefentry><refentrytitle>glMatrixMode</refentrytitle></citerefentry>.</term>
<listitem>
</listitem>
</varlistentry>
<varlistentry>
<term>4. RGBA components may be multiplied by <constant>GL_POST_COLOR_MATRIX_c_SCALE</constant>,</term>
<listitem>
<para>
and added to <constant>GL_POST_COLOR_MATRIX_c_BIAS</constant>, if enabled. See
<citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>5. Color component replacement by the color table specified for</term>
<listitem>
<para>
<constant>GL_POST_COLOR_MATRIX_COLOR_TABLE</constant>, if enabled. See
<citerefentry><refentrytitle>glColorTable</refentrytitle></citerefentry>.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
Non-power-of-two textures are supported if the GL version is 2.0 or greater, or if the implementation exports the <constant>GL_ARB_texture_non_power_of_two</constant> extension.
</para>
<para>
The
<constant>GL_SRGB</constant>,
<constant>GL_SRGB8</constant>,
<constant>GL_SRGB_ALPHA</constant>,
<constant>GL_SRGB8_ALPHA8</constant>,
<constant>GL_SLUMINANCE</constant>,
<constant>GL_SLUMINANCE8</constant>,
<constant>GL_SLUMINANCE_ALPHA</constant>, and
<constant>GL_SLUMINANCE8_ALPHA8</constant>
internal formats are only available if the GL version is 2.1 or greater.
</para>
</refsect1>
<refsect1 id="errors"><title>Errors</title>
<para>
<constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not <constant>GL_TEXTURE_3D</constant>
or <constant>GL_PROXY_TEXTURE_3D</constant>.
</para>
<para>
<constant>GL_INVALID_ENUM</constant> is generated if <parameter>format</parameter> is not an accepted
format constant. Format constants other than <constant>GL_STENCIL_INDEX</constant> and <constant>GL_DEPTH_COMPONENT</constant>
are accepted.
</para>
<para>
<constant>GL_INVALID_ENUM</constant> is generated if <parameter>type</parameter> is not a type constant.
</para>
<para>
<constant>GL_INVALID_ENUM</constant> is generated if <parameter>type</parameter> is <constant>GL_BITMAP</constant> and
<parameter>format</parameter> is not <constant>GL_COLOR_INDEX</constant>.
</para>
<para>
<constant>GL_INVALID_VALUE</constant> is generated if <parameter>level</parameter> is less than 0.
</para>
<para>
<constant>GL_INVALID_VALUE</constant> may be generated if <parameter>level</parameter> is greater than
<inlineequation><mml:math>
<!-- eqn: log sub 2 (max):-->
<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:mi mathvariant="italic">max</mml:mi>
</mml:mfenced>
</mml:mrow>
</mml:math></inlineequation>,
where <emphasis>max</emphasis> is the returned value of <constant>GL_MAX_TEXTURE_SIZE</constant>.
</para>
<para>
<constant>GL_INVALID_VALUE</constant> is generated if <parameter>internalFormat</parameter> is not 1, 2, 3, 4, or one of the
accepted resolution and format symbolic constants.
</para>
<para>
<constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter>, <parameter>height</parameter>, or <parameter>depth</parameter> is less than 0 or greater than 2 + <constant>GL_MAX_TEXTURE_SIZE</constant>.
</para>
<para>
<constant>GL_INVALID_VALUE</constant> is generated if non-power-of-two textures are not supported and the <parameter>width</parameter>, <parameter>height</parameter>, or <parameter>depth</parameter> cannot be represented as
<inlineequation><mml:math>
<!-- eqn: 2 sup k + 2( border ):-->
<mml:mrow>
<mml:msup><mml:mn>2</mml:mn>
<mml:mi mathvariant="italic">k</mml:mi>
</mml:msup>
<mml:mo>+</mml:mo>
<mml:mrow>
<mml:mn>2</mml:mn>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mi mathvariant="italic">border</mml:mi>
</mml:mfenced>
</mml:mrow>
</mml:mrow>
</mml:math></inlineequation>
for some
integer value of <emphasis>k</emphasis>.
</para>
<para>
<constant>GL_INVALID_VALUE</constant> is generated if <parameter>border</parameter> is not 0 or 1.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if <parameter>type</parameter> is one of
<constant>GL_UNSIGNED_BYTE_3_3_2</constant>,
<constant>GL_UNSIGNED_BYTE_2_3_3_REV</constant>,
<constant>GL_UNSIGNED_SHORT_5_6_5</constant>, or
<constant>GL_UNSIGNED_SHORT_5_6_5_REV</constant>
and <parameter>format</parameter> is not <constant>GL_RGB</constant>.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if <parameter>type</parameter> is one of
<constant>GL_UNSIGNED_SHORT_4_4_4_4</constant>,
<constant>GL_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
<constant>GL_UNSIGNED_SHORT_5_5_5_1</constant>,
<constant>GL_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
<constant>GL_UNSIGNED_INT_8_8_8_8</constant>,
<constant>GL_UNSIGNED_INT_8_8_8_8_REV</constant>,
<constant>GL_UNSIGNED_INT_10_10_10_2</constant>, or
<constant>GL_UNSIGNED_INT_2_10_10_10_REV</constant>
and <parameter>format</parameter> is neither <constant>GL_RGBA</constant> nor <constant>GL_BGRA</constant>.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if <parameter>format</parameter> or <parameter>internalFormat</parameter> is
<constant>GL_DEPTH_COMPONENT</constant>, <constant>GL_DEPTH_COMPONENT16</constant>,
<constant>GL_DEPTH_COMPONENT24</constant>, or <constant>GL_DEPTH_COMPONENT32</constant>.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
<constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the buffer object's data store is currently mapped.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
<constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the data would be unpacked from the buffer
object such that the memory reads required would exceed the data store size.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
<constant>GL_PIXEL_UNPACK_BUFFER</constant> target and <parameter>data</parameter> is not evenly divisible
into the number of bytes needed to store in memory a datum indicated by <parameter>type</parameter>.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if <function>glTexImage3D</function>
is executed between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>
and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
</para>
</refsect1>
<refsect1 id="associatedgets"><title>Associated Gets</title>
<para>
<citerefentry><refentrytitle>glGetTexImage</refentrytitle></citerefentry>
</para>
<para>
<citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_3D</constant>
</para>
<para>
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_UNPACK_BUFFER_BINDING</constant>
</para>
</refsect1>
<refsect1 id="seealso"><title>See Also</title>
<para>
<citerefentry><refentrytitle>glActiveTexture</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glColorTable</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCompressedTexImage1D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCompressedTexImage2D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCompressedTexImage3D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCompressedTexSubImage1D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCompressedTexSubImage2D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCompressedTexSubImage3D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCopyPixels</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCopyTexImage1D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCopyTexImage2D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCopyTexSubImage1D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCopyTexSubImage2D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glCopyTexSubImage3D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glGetCompressedTexImage</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glMatrixMode</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTexEnv</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTexGen</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTexSubImage1D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTexSubImage2D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTexSubImage3D</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTexParameter</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>