GLTEXIMAGE3DEXT(3gl)GLTEXIMAGE3DEXT(3gl)NAME
glTexImage3DEXT - specify a three-dimensional texture image
C SPECIFICATION
void glTexImage3DEXT( GLenum target,
GLint level,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLsizei depth,
GLint border,
GLenum format,
GLenum type,
const GLvoid* pixels)
PARAMETERS
target Specifies the target texture. Must be GL_TEXTURE_3D_EXT
or GL_PROXY_TEXTURE_3D_EXT.
level Specifies the level-of-detail number. Level 0 is the
base image level. Level n is the nth mipmap reduction
image.
internalformat Specifies the internal storage format of the texture
image. It must be one of the following symbolic con‐
stants: GL_ALPHA, GL_ALPHA4, GL_ALPHA8, GL_ALPHA12,
GL_ALPHA16, GL_LUMINANCE, GL_LUMINANCE4, GL_LUMINANCE8,
GL_LUMINANCE12, GL_LUMINANCE16, GL_LUMINANCE_ALPHA,
GL_LUMINANCE4_ALPHA4, GL_LUMINANCE6_ALPHA2, GL_LUMI‐
NANCE8_ALPHA8, GL_LUMINANCE12_ALPHA4, GL_LUMI‐
NANCE12_ALPHA12, GL_LUMINANCE16_ALPHA16, GL_INTENSITY,
GL_INTENSITY4, GL_INTENSITY8, GL_INTENSITY12, GL_INTEN‐
SITY16, GL_RGB,GL_RGB4, GL_RGB5, GL_RGB8, GL_RGB10,
GL_RGB12, GL_RGB16, GL_RGBA, GL_RGBA2, GL_RGBA4,
GL_RGB5_A1, GL_RGBA8, GL_RGB10_A2, GL_RGBA12,
GL_RGBA16, GL_COMPRESSED_ALPHA, GL_COMPRESSED_LUMI‐
NANCE, GL_COMPRESSED_LUMINANCE_ALPHA, GL_COM‐
PRESSED_INTENSITY, GL_COMPRESSED_RGB, GL_COM‐
PRESSED_RGBA.
width Specifies the width of the texture image. Must be
2^n+2(border) for some integer n.
height Specifies the height of the texture image. Must be
2^m+2(border) for some integer m.
depth Specifies the depth of the texture image. Must be
2^l+2(border) for some integer l.
border Specifies the width of the border. Must be either 0 or
1.
format Specifies the format of the pixel data. The following
symbolic values are accepted: GL_COLOR_INDEX, GL_RED,
GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_RGBA,
GL_ABGR_EXT, GL_LUMINANCE, and GL_LUMINANCE_ALPHA.
type Specifies the data type of the pixel data. The follow‐
ing symbolic values are accepted: GL_UNSIGNED_BYTE,
GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT,
GL_INT, GL_FLOAT.
pixels Specifies a pointer to the image data in memory.
DESCRIPTION
Texturing maps a portion of a specified texture image onto each graphi‐
cal primitive for which texturing is enabled. Three-dimensional tex‐
turing is enabled and disabled using glEnable and glDisable with argu‐
ment GL_TEXTURE_3D_EXT.
Texture images are defined with glTexImage3DEXT. The arguments describe
the parameters of the texture image, such as height, width, depth,
width of the border, level-of-detail number (see glTexParameter), and
the internal resolution and format used to store the image. The last
three arguments describe the way the image is represented in memory,
and they are identical to the pixel formats used for glDrawPixels.
If target is GL_PROXY_TEXTURE_3D_EXT no data is read from pixels, but
all of the texture image state is recalculated, checked for consis‐
tency, and checked against the implementation's capabilities. If the
implementation cannot handle a texture of the requested texture size,
it will set all of the texture image state to 0 (GL_TEXTURE_WIDTH,
GL_TEXTURE_HEIGHT, GL_TEXTURE_BORDER, GL_TEXTURE_COMPONENTS, GL_TEX‐
TURE_RED_SIZE, GL_TEXTURE_GREEN_SIZE, GL_TEXTURE_BLUE_SIZE, GL_TEX‐
TURE_ALPHA_SIZE, GL_TEXTURE_LUMINANCE_SIZE, and GL_TEXTURE_INTEN‐
SITY_SIZE), but no error will be generated.
If target is GL_TEXTURE_3D_EXT, data is read from pixels as a sequence
of signed or unsigned bytes, shorts, or longs, or single-precision
floating-point values, depending on type. These values are grouped
into sets of one, two, three, or four values, depending on format, to
form elements.
The first element corresponds to the lower-left-rear corner of the tex‐
ture volume. Subsequent elements progress left-to-right through the
remaining texels in the lowest-rear row of the texture volume, then in
successively higher rows of the rear 2D slice of the texture volume,
then in successively closer 2D slices of the texture volume. The final
element corresponds to the upper-right-front corner of the texture vol‐
ume.
Each element of pixels is converted to an RGBA element according to
format, as detailed below. Except for GL_COLOR_INDEX, after the con‐
version to RGBA, each component is multiplied by the signed scale fac‐
tor GL_c_SCALE, added to the signed bias GL_c_BIAS, and clamped to the
range [0,1], where c is GL_RED, GL_GREEN, GL_BLUE, or GL_ALPHA, respec‐
tively (see glPixelTransfer).
According to format, the conversion to RGBA is as follows:
GL_COLOR_INDEX
Each element is a single value, a color index. It is converted
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 GL_INDEX_SHIFT, and added to GL_INDEX_OFF‐
SET (see glPixelTransfer). The resulting index is converted to a
set of color components using the GL_PIXEL_MAP_I_TO_R,
GL_PIXEL_MAP_I_TO_G, GL_PIXEL_MAP_I_TO_B, and
GL_PIXEL_MAP_I_TO_A tables, and clamped to the range [0,1].
GL_RED Each element is a single red component. It is converted to
floating point and assembled into an RGBA element by attaching
0.0 for green and blue, and 1.0 for alpha.
GL_GREEN
Each element is a single green component. It is converted to
floating point and assembled into an RGBA element by attaching
0.0 for red and blue, and 1.0 for alpha.
GL_BLUE
Each element is a single blue component. It is converted to
floating point and assembled into an RGBA element by attaching
0.0 for red and green, and 1.0 for alpha.
GL_ALPHA
Each element is a single alpha component. It is converted to
floating point and assembled into an RGBA element by attaching
0.0 for red, green, and blue.
GL_RGB Each element is an RGB triple. It is converted to floating point
and assembled into an RGBA element by attaching 1.0 for alpha.
(See glPixelTransfer).
GL_RGBA
GL_ABGR_EXT
Each element contains all four components; for GL_RGBA, the red
component is first, followed by green, then blue, and then
alpha; for GL_ABGR_EXT the order is alpha, blue, green, and then
red.
GL_LUMINANCE
Each element is a single luminance value. It is converted to
floating point, then assembled into an RGBA element by replicat‐
ing the luminance value three times for red, green, and blue and
attaching 1.0 for alpha.
GL_LUMINANCE_ALPHA
Each element is a luminance/alpha pair. It is converted to
floating point, then assembled into an RGBA element by replicat‐
ing the luminance value three times for red, green, and blue.
Please refer to the glDrawPixels reference page for a description of
the acceptable values for the type parameter.
An application may desire that the texture be stored at a certain reso‐
lution, or that it be stored in a certain format. This resolution and
format can be requested by internalformat, but the implementation may
not support that resolution (The formats of GL_LUMINANCE, GL_LUMI‐
NANCE_ALPHA, GL_RGB, and GL_RGBA must be supported). When a resolution
and storage format is specified, the implementation will update the
texture state to provide the best match to the requested resolution.
The GL_PROXY_TEXTURE_3D_EXT target can be used to try a resolution and
format. The implementation will compute its best match for the
requested storage resolution and format; this state can then be queried
using glGetTexLevelParameter.Proxy texture can also be used to query if
the format/internalformat/type combination will result in constant tex‐
ture.
The base internal format is derived from the user specified internal
formats as follows: All resolutions of a particular internal format,
for example GL_ALPHA4, GL_ALPHA8, GL_ALPHA12, GL_ALPHA, GL_ALPHA16 are
of base internal format GL_ALPHA. Similarly, all resolutions of inter‐
nal format GL_LUMINANCE are of base internal format GL_LUMINANCE. All
resolutions of GL_INTENSITY are of base format GL_INTENSITY. All reso‐
lutions of GL_LUMINANCE_ALPHA are of base format GL_LUMINANCE_ALPHA.
All resolutions of GL_RGB are of base format GL_RGB and all resolutions
of GL_RGBA are of base format GL_RGBA.
A base internal format of GL_LUMINANCE or GL_INTENSITY uses only the
red component of the RGBA color extracted from pixels. A base internal
format of GL_LUMINANCE_ALPHA uses the R and A values. A base internal
format of GL_RGB uses the R, G, and B values. A base internal format
of GL_ALPHA uses the A value. A base internal format of GL_RGBA uses
all the RGBA components.
Two more storage parameters are added to glPixelStore to support 3D
image formats in memory. GL_UNPACK* affects how pixel data is read from
client memory. The first, GL_UNPACK_IMAGE_HEIGHT_EXT - if the value is
not greater than zero, then the number of rows in each 2- dimensional
slice is height; otherwise the number of rows is
GL_UNPACK_IMAGE_HEIGHT. The second, GL_UNPACK_SKIP_IMAGES_EXT - if the
value is greater than zero, then the image pointer is advanced by
GL_UNPACK_SKIP_IMAGES_EXT times the number of elements in one 2-dimen‐
sional slice. Then depth 2-dimensional slices are processed, each hav‐
ing a subimage extracted in the manner described in glTexImage2D. Dur‐
ing glGetTexImage, 2 additional storage parameters
GL_PACK_IMAGE_HEIGHT_EXT and GL_PACK_SKIP_IMAGES_EXT are considered.
These two storage parameters affect how pixel data is returned to
client memory.
One additional table lookup in the pixel transfer stage and one addi‐
tional color table lookup to texture processing stage may be added by
enabling the color table and texture color table respectively (see
glColorTableSGI).
The additional token value GL_TEXTURE_WRAP_R_EXT is accepted by glTex‐
Parameteri, glTexParameterv, glTexParameteriv, glTexParameterfv with
values GL_CLAMP and GL_REPEAT. If GL_TEXTURE_WRAP_R_EXT is set to
GL_REPEAT, then the GL ignores the integer part of the R coordinates,
using only the fractional part. GL_CLAMP causes R to be clamped to the
range [0,1]. The initial state for GL_TEXTURE_WRAP_R_EXT is GL_REPEAT.
The value can get gotten using glGetTexParameter. glPushAttrib that
includes the symbolic constant GL_TEXTURE_BIT will push GL_TEX‐
TURE_WRAP_R_EXT parameter onto the stack.
NOTES
Texturing has no effect in color index mode.
The texture image can be represented by the same data formats and types
as the pixels in a glDrawPixels command, except that formats GL_STEN‐
CIL_INDEX and GL_DEPTH_COMPONENT cannot be used, and type GL_BITMAP
cannot be used. glPixelStore and glPixelTransfer modes affect texture
images in exactly the way they affect glDrawPixels.
A texture image with zero height, width, or depth indicates the null
texture. If the null texture is specified for level-of-detail 0, it is
as if texturing were disabled.
glColorTableSGI is part of the GL_SGI_color_table extension, and is
also used by the GL_SGI_texture_color_table extension.
glTexImage3DEXT is part of the GL_EXT_texture3d extension.
If GL_UNPACK_CONSTANT_DATA_SUNX(see glPixelStore) is set to GL_TRUE and
all other unpack pixel store values are default, then the pixels
pointer may be used internally without the library making a second
copy. Note that whether an application specified constant texture is
used as-is internally is implementation dependent, an implementation
may still make a second copy if necessary. It is the application's
responsibility to make sure that the format/internal format combination
is meaningful when constant data is used. For example, if the format is
GL_ABGR_EXT and the internalformat is GL_LUMINANCE, then the pixels
sent down as constant data should have the same value in the R, G and B
channels and a 1 for alpha. Note that GL_UNPACK_CONSTANT_DATA_SUNX is
ignored if pixel transfer is enabled.
If GL_UNPACK_CONSTANT_DATA_SUNX is set to GL_TRUE and application wants
to change part of the texture image that has been sent down, the appli‐
cation should first call glFinishTextureSUNX before a part or all of
this texture image is changed.
If a texture image is defined as constant during display list creation,
then the contents of the texture image should remain unchanged for the
life of the display list. Changing this constant texture image will
result in unpredictable results.
ERRORS
GL_INVALID_ENUM is generated when target is not an accepted value.
GL_INVALID_ENUM is generated when format is not an accepted value.
GL_INVALID_ENUM is generated when type is not an accepted value.
GL_INVALID_VALUE is generated if level is less than zero or greater
than log2max, where max is the returned value of GL_MAX_3D_TEX‐
TURE_SIZE_EXT.
GL_INVALID_VALUE is generated if internalformat is not an accepted
value.
GL_INVALID_VALUE is generated if width, height, or depth is less than
zero or greater than GL_MAX_3D_TEXTURE_SIZE_EXT, or if width, height or
depth cannot be represented as 2^k+2(border) for some integer k.
GL_INVALID_VALUE is generated if border is not 0 or 1.
GL_INVALID_OPERATION is generated if glTexImage3DEXT is executed
between the execution of glBegin and the corresponding execution of
glEnd.
GL_INVALID_VALUE is generated if the implementation cannot accommodate
a texture of the size requested.
ASSOCIATED GETS
glGetTexImage,
glIsEnabled with argument GL_TEXTURE_3D_EXT,
glGetTexLevelParameter with a first argument of GL_PROXY_TEXTURE_3D_EXT
and a third argument of GL_TEXTURE_RED_SIZE_EXT, GL_TEX‐
TURE_GREEN_SIZE_EXT, GL_TEXTURE_BLUE_SIZE_EXT, GL_TEX‐
TURE_ALPHA_SIZE_EXT, GL_TEXTURE_LUMINANCE_SIZE_EXT, GL_TEXTURE_INTEN‐
SITY_SIZE_EXT, GL_TEXTURE_WIDTH, GL_TEXTURE_HEIGHT, GL_TEX‐
TURE_DEPTH_EXT, GL_TEXTURE_BORDER, or GL_TEXTURE_COMPONENTS.
SEE ALSO
glDrawPixels, glFog, glPixelStore, glPixelTransfer, glTexEnv, glTexGen,
glTexImage1D, glTexImage2D, glTexParameter, glTexSubImage1D, glCopyTex‐
SubImage1D, glTexSubImage2D, glCopyTexSubImage2D, glTexSubImage3DEXT,
glCopyTexSubImage3DEXT, glColorTableSGI, glCopyColorTableSGI, glGetTex‐
Image, glPushAttrib, glFinishTextureSUNX, glGetTexLevelParamater.
15 Mar 97 GLTEXIMAGE3DEXT(3gl)