xenocara/doc/gl-docs/GL/gl/teximage3d.3gl

471 lines
16 KiB
Plaintext
Raw Normal View History

'\" e
'\"! eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 teximage3
.ds Xs 11081 17 teximage3d.gl
.TH GLTEXIMAGE3D 3G
.SH NAME
.B "glTexImage3D
\- specify a three-dimensional texture image
.SH C SPECIFICATION
void \f3glTexImage3D\fP(
GLenum \fItarget\fP,
.nf
.ta \w'\f3void \fPglTexImage3D( 'u
GLint \fIlevel\fP,
GLint \fIinternalFormat\fP,
GLsizei \fIwidth\fP,
GLsizei \fIheight\fP,
GLsizei \fIdepth\fP,
GLint \fIborder\fP,
GLenum \fIformat\fP,
GLenum \fItype\fP,
const GLvoid \fI*pixels\fP )
.fi
.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\fIinternalFormat\fP\ \ 'u
\f2target\fP
Specifies the target texture.
Must be \%\f3GL_TEXTURE_3D\fP or \%\f3GL_PROXY_TEXTURE_3D\fP.
.TP
\f2level\fP
Specifies the level-of-detail number.
Level 0 is the base image level.
Level $n$ is the $n sup th$ mipmap reduction image.
.TP
\f2internalFormat\fP
Specifies the number of color components in the texture.
Must be 1, 2, 3, or 4, or one of the following symbolic constants:
\%\f3GL_ALPHA\fP,
\%\f3GL_ALPHA4\fP,
\%\f3GL_ALPHA8\fP,
\%\f3GL_ALPHA12\fP,
\%\f3GL_ALPHA16\fP,
\%\f3GL_LUMINANCE\fP,
\%\f3GL_LUMINANCE4\fP,
\%\f3GL_LUMINANCE8\fP,
\%\f3GL_LUMINANCE12\fP,
\%\f3GL_LUMINANCE16\fP,
\%\f3GL_LUMINANCE_ALPHA\fP,
\%\f3GL_LUMINANCE4_ALPHA4\fP,
\%\f3GL_LUMINANCE6_ALPHA2\fP,
\%\f3GL_LUMINANCE8_ALPHA8\fP,
\%\f3GL_LUMINANCE12_ALPHA4\fP,
\%\f3GL_LUMINANCE12_ALPHA12\fP,
\%\f3GL_LUMINANCE16_ALPHA16\fP,
\%\f3GL_INTENSITY\fP,
\%\f3GL_INTENSITY4\fP,
\%\f3GL_INTENSITY8\fP,
\%\f3GL_INTENSITY12\fP,
\%\f3GL_INTENSITY16\fP,
\%\f3GL_R3_G3_B2\fP,
\%\f3GL_RGB\fP,
\%\f3GL_RGB4\fP,
\%\f3GL_RGB5\fP,
\%\f3GL_RGB8\fP,
\%\f3GL_RGB10\fP,
\%\f3GL_RGB12\fP,
\%\f3GL_RGB16\fP,
\%\f3GL_RGBA\fP,
\%\f3GL_RGBA2\fP,
\%\f3GL_RGBA4\fP,
\%\f3GL_RGB5_A1\fP,
\%\f3GL_RGBA8\fP,
\%\f3GL_RGB10_A2\fP,
\%\f3GL_RGBA12\fP, or
\%\f3GL_RGBA16\fP.
.TP
\f2width\fP
Specifies the width of the texture image.
Must be $2 sup n ~+~ 2 ( "border" )$ for some integer $n$. All
implementations support texture images that are at least 64 texels
wide.
.TP
\f2height\fP
Specifies the height of the texture image.
Must be $2 sup m ~+~ 2 ( "border" )$ for some integer $m$. All
implementations support texture images that are at least 64 texels
high.
.TP
\f2depth\fP
Specifies the depth of the texture image.
Must be $2 sup k ~+~ 2 ( "border" )$ for some integer $k$. All
implementations support texture images that are at least 64 texels
deep.
.TP
\f2border\fP
Specifies the width of the border.
Must be either 0 or 1.
.TP
\f2format\fP
Specifies the of the pixel data.
The following symbolic values are accepted:
\%\f3GL_COLOR_INDEX\fP,
\%\f3GL_RED\fP,
\%\f3GL_GREEN\fP,
\%\f3GL_BLUE\fP,
\%\f3GL_ALPHA\fP,
\%\f3GL_RGB\fP,
\%\f3GL_BGR\fP,
\%\f3GL_RGBA\fP,
\%\f3GL_BGRA\fP,
\%\f3GL_LUMINANCE\fP, and
\%\f3GL_LUMINANCE_ALPHA\fP.
.TP
\f2type\fP
Specifies the data type of the pixel data.
The following symbolic values are accepted:
\%\f3GL_UNSIGNED_BYTE\fP,
\%\f3GL_BYTE\fP,
\%\f3GL_BITMAP\fP,
\%\f3GL_UNSIGNED_SHORT\fP,
\%\f3GL_SHORT\fP,
\%\f3GL_UNSIGNED_INT\fP,
\%\f3GL_INT\fP,
\%\f3GL_FLOAT\fP
\%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
\%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
\%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
\%\f3GL_UNSIGNED_INT_10_10_10_2\fP, and
\%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP.
.TP
\f2pixels\fP
Specifies a pointer to the image data in memory.
.SH DESCRIPTION
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 \%\f3glEnable\fP
and \%\f3glDisable\fP with argument \%\f3GL_TEXTURE_3D\fP.
.P
To define texture images, call \%\f3glTexImage3D\fP.
The arguments describe the parameters of the texture image,
such as height,
width, depth,
width of the border,
level-of-detail number
(see \%\f3glTexParameter\fP),
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 \%\f3glDrawPixels\fP.
.P
If \f2target\fP is \%\f3GL_PROXY_TEXTURE_3D\fP, no data is read from \f2pixels\fP, 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 \%\f3glGetError\fP). To query for an
entire mipmap array, use an image array level greater than or equal to
1.
.P
If \f2target\fP is \%\f3GL_TEXTURE_3D\fP,
data is read from \f2pixels\fP as a sequence of signed or unsigned bytes,
shorts,
or longs,
or single-precision floating-point values,
depending on \f2type\fP.
These values are grouped into sets of one,
two,
three,
or four values,
depending on \f2format\fP,
to form elements.
If \f2type\fP is \%\f3GL_BITMAP\fP,
the data is considered as a string of unsigned bytes (and
\f2format\fP must be \%\f3GL_COLOR_INDEX\fP).
Each data byte is treated as eight 1-bit elements,
with bit ordering determined by \%\f3GL_UNPACK_LSB_FIRST\fP
(see \%\f3glPixelStore\fP).
.P
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.
.P
\f2format\fP determines the composition of each element in \f2pixels\fP.
It can assume one of eleven symbolic values:
.TP 10
\%\f3GL_COLOR_INDEX\fP
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 \%\f3GL_INDEX_SHIFT\fP,
and added to \%\f3GL_INDEX_OFFSET\fP
(see
.br
\%\f3glPixelTransfer\fP).
The resulting index is converted to a set of color components
using the
\%\f3GL_PIXEL_MAP_I_TO_R\fP,
\%\f3GL_PIXEL_MAP_I_TO_G\fP,
\%\f3GL_PIXEL_MAP_I_TO_B\fP, and
\%\f3GL_PIXEL_MAP_I_TO_A\fP tables,
and clamped to the range [0,1].
.TP
\%\f3GL_RED\fP
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 \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_GREEN\fP
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 \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_BLUE\fP
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 \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_ALPHA\fP
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 \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_RGB\fP
.TP
\%\f3GL_BGR\fP
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 \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see
.br
\%\f3glPixelTransfer\fP).
.TP
\%\f3GL_RGBA\fP
.TP
\%\f3GL_BGRA\fP
Each element contains all four components.
Each component is multiplied by the signed scale factor \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_LUMINANCE\fP
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 \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_LUMINANCE_ALPHA\fP
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 \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see
.br
\%\f3glPixelTransfer\fP).
.P
Refer to the \%\f3glDrawPixels\fP reference page for a description of
the acceptable values for the \f2type\fP parameter.
.P
If an application wants to store the texture at a certain
resolution or in a certain , it can request the resolution
and with \f2internalFormat\fP. The GL will choose an internal
representation that closely approximates that requested by \f2internalFormat\fP, but
it may not match exactly.
(The representations specified by \%\f3GL_LUMINANCE\fP,
\%\f3GL_LUMINANCE_ALPHA\fP, \%\f3GL_RGB\fP,
and \%\f3GL_RGBA\fP must match exactly. The numeric values 1, 2, 3, and 4
may also be used to specify the above representations.)
.P
Use the \%\f3GL_PROXY_TEXTURE_3D\fP target to try out a resolution and
. The implementation will
update and recompute its best match for the requested storage resolution
and . To then query this state, call
\%\f3glGetTexLevelParameter\fP.
If the texture cannot be accommodated, texture state is set to 0.
.P
A one-component texture image uses only the red component of the RGBA
color extracted from \f2pixels\fP.
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.
.SH NOTES
Texturing has no effect in color index mode.
.P
The texture image can be represented by the same data formats
as the pixels in a \%\f3glDrawPixels\fP command,
except that \%\f3GL_STENCIL_INDEX\fP and \%\f3GL_DEPTH_COMPONENT\fP
cannot be used.
\%\f3glPixelStore\fP and \%\f3glPixelTransfer\fP modes affect texture images
in exactly the way they affect \%\f3glDrawPixels\fP.
.P
.P
\%\f3glTexImage3D\fP is available only if the GL version is 1.2 or greater.
.P
Internal formats other than 1, 2, 3, or 4 may be used only if the GL
version is 1.1 or greater.
.P
\f2pixels\fP may be a null pointer.
In this case texture memory is
allocated to accommodate a texture of width \f2width\fP, height \f2height\fP,
and depth \f2depth\fP.
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.
.P
Formats \%\f3GL_BGR\fP, and \%\f3GL_BGRA\fP and types
\%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
\%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
\%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
\%\f3GL_UNSIGNED_INT_10_10_10_2\fP, and
\%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP are available only if the GL version
is 1.2 or greater.
.P
When the \%\f3GL_ARB_multitexture\fP extension is supported, \%\f3glTexImage3D\fP
specifies the three-dimensional texture for the current texture unit,
specified with \%\f3glActiveTextureARB\fP.
.P
If the \%\f3GL_ARB_imaging\fP 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
[0,\ 1]:
.TP 3
1. Color component replacement by the color table specified for
\%\f3GL_COLOR_TABLE\fP, if enabled. See \%\f3glColorTable\fP.
.TP
2. Color component replacement by the color table specified for
\%\f3GL_POST_CONVOLUTION_COLOR_TABLE\fP, if enabled. See \%\f3glColorTable\fP.
.TP
3. Transformation by the color matrix. See \%\f3glMatrixMode\fP.
.TP
4. RGBA components may be multiplied by \%\f3GL_POST_COLOR_MATRIX_c_SCALE\fP,
and added to \%\f3GL_POST_COLOR_MATRIX_c_BIAS\fP, if enabled. See
\%\f3glPixelTransfer\fP.
.TP
5. Color component replacement by the color table specified for
\%\f3GL_POST_COLOR_MATRIX_COLOR_TABLE\fP, if enabled. See
\%\f3glColorTable\fP.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2target\fP is not \%\f3GL_TEXTURE_3D\fP
or \%\f3GL_PROXY_TEXTURE_3D\fP.
.P
\%\f3GL_INVALID_ENUM\fP is generated if \f2format\fP is not an accepted
constant.
Format constants other than \%\f3GL_STENCIL_INDEX\fP and \%\f3GL_DEPTH_COMPONENT\fP
are accepted.
.P
\%\f3GL_INVALID_ENUM\fP is generated if \f2type\fP is not a type constant.
.P
\%\f3GL_INVALID_ENUM\fP is generated if \f2type\fP is \%\f3GL_BITMAP\fP and
\f2format\fP is not \%\f3GL_COLOR_INDEX\fP.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2level\fP is less than 0.
.P
.P
\%\f3GL_INVALID_VALUE\fP may be generated if \f2level\fP is greater than $log
sub 2$\f2max\fP,
where \f2max\fP is the returned value of \%\f3GL_MAX_TEXTURE_SIZE\fP.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2internalFormat\fP is not 1, 2, 3, 4, or one of the
accepted resolution and symbolic constants.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2width\fP, \f2height\fP, or \f2depth\fP
is less than 0 or greater than 2 + \%\f3GL_MAX_TEXTURE_SIZE\fP,
or if either cannot be represented as $2 sup k ~+~ 2( "border" )$ for some
integer value of \f2k\fP.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2border\fP is not 0 or 1.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glTexImage3D\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \f2type\fP is one of
\%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
\%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5\fP, or
\%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP
and \f2format\fP is not \%\f3GL_RGB\fP.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \f2type\fP is one of
\%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
\%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
\%\f3GL_UNSIGNED_INT_10_10_10_2\fP, or
\%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP
and \f2format\fP is neither \%\f3GL_RGBA\fP nor \%\f3GL_BGRA\fP.
.SH ASSOCIATED GETS
\%\f3glGetTexImage\fP
.br
\%\f3glIsEnabled\fP with argument \%\f3GL_TEXTURE_3D\fP
.SH SEE ALSO
\%\f3glActiveTextureARB(3G)\fP,
\%\f3glCopyPixels(3G)\fP,
\%\f3glCopyTexImage1D(3G)\fP,
\%\f3glCopyTexImage2D(3G)\fP,
\%\f3glCopyTexSubImage1D(3G)\fP,
\%\f3glCopyTexSubImage2D(3G)\fP,
\%\f3glCopyTexSubImage3D(3G)\fP,
\%\f3glDrawPixels(3G)\fP,
\%\f3glPixelStore(3G)\fP,
\%\f3glPixelTransfer(3G)\fP,
\%\f3glTexEnv(3G)\fP,
\%\f3glTexGen(3G)\fP,
\%\f3glTexImage1D(3G)\fP,
\%\f3glTexImage2D(3G)\fP,
\%\f3glTexSubImage1D(3G)\fP,
\%\f3glTexSubImage2D(3G)\fP,
\%\f3glTexSubImage3D(3G)\fP,
\%\f3glTexParameter(3G)\fP