NAME
glTexImage3D
- specify a three-dimensional texture image
C SPECIFICATION
void ggllTTeexxIImmaaggee33DD(
GLenum _t_a_r_g_e_t,
GLint _l_e_v_e_l,
GLint _i_n_t_e_r_n_a_l_F_o_r_m_a_t,
GLsizei _w_i_d_t_h,
GLsizei _h_e_i_g_h_t,
GLsizei _d_e_p_t_h,
GLint _b_o_r_d_e_r,
GLenum _f_o_r_m_a_t,
GLenum _t_y_p_e,
const GLvoid _*_p_i_x_e_l_s )
delim $$
PARAMETERS
-
_t_a_r_g_e_t
-
Specifies the target texture.
Must be GGLL__TTEEXXTTUURREE__33DD or GGLL__PPRROOXXYY__TTEEXXTTUURREE__33DD.
-
_l_e_v_e_l
-
Specifies the level-of-detail number.
Level 0 is the base image level.
Level $n$ is the $n sup th$ mipmap reduction image.
-
_i_n_t_e_r_n_a_l_F_o_r_m_a_t
-
Specifies the number of color components in the texture.
Must be 1, 2, 3, or 4, or one of the following symbolic constants:
GGLL__AALLPPHHAA,
GGLL__AALLPPHHAA44,
GGLL__AALLPPHHAA88,
GGLL__AALLPPHHAA1122,
GGLL__AALLPPHHAA1166,
GGLL__LLUUMMIINNAANNCCEE,
GGLL__LLUUMMIINNAANNCCEE44,
GGLL__LLUUMMIINNAANNCCEE88,
GGLL__LLUUMMIINNAANNCCEE1122,
GGLL__LLUUMMIINNAANNCCEE1166,
GGLL__LLUUMMIINNAANNCCEE__AALLPPHHAA,
GGLL__LLUUMMIINNAANNCCEE44__AALLPPHHAA44,
GGLL__LLUUMMIINNAANNCCEE66__AALLPPHHAA22,
GGLL__LLUUMMIINNAANNCCEE88__AALLPPHHAA88,
GGLL__LLUUMMIINNAANNCCEE1122__AALLPPHHAA44,
GGLL__LLUUMMIINNAANNCCEE1122__AALLPPHHAA1122,
GGLL__LLUUMMIINNAANNCCEE1166__AALLPPHHAA1166,
GGLL__IINNTTEENNSSIITTYY,
GGLL__IINNTTEENNSSIITTYY44,
GGLL__IINNTTEENNSSIITTYY88,
GGLL__IINNTTEENNSSIITTYY1122,
GGLL__IINNTTEENNSSIITTYY1166,
GGLL__RR33__GG33__BB22,
GGLL__RRGGBB,
GGLL__RRGGBB44,
GGLL__RRGGBB55,
GGLL__RRGGBB88,
GGLL__RRGGBB1100,
GGLL__RRGGBB1122,
GGLL__RRGGBB1166,
GGLL__RRGGBBAA,
GGLL__RRGGBBAA22,
GGLL__RRGGBBAA44,
GGLL__RRGGBB55__AA11,
GGLL__RRGGBBAA88,
GGLL__RRGGBB1100__AA22,
GGLL__RRGGBBAA1122, or
GGLL__RRGGBBAA1166.
-
_w_i_d_t_h
-
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.
-
_h_e_i_g_h_t
-
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.
-
_d_e_p_t_h
-
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.
-
_b_o_r_d_e_r
-
Specifies the width of the border.
Must be either 0 or 1.
-
_f_o_r_m_a_t
-
Specifies the of the pixel data.
The following symbolic values are accepted:
GGLL__CCOOLLOORR__IINNDDEEXX,
GGLL__RREEDD,
GGLL__GGRREEEENN,
GGLL__BBLLUUEE,
GGLL__AALLPPHHAA,
GGLL__RRGGBB,
GGLL__BBGGRR,
GGLL__RRGGBBAA,
GGLL__BBGGRRAA,
GGLL__LLUUMMIINNAANNCCEE, and
GGLL__LLUUMMIINNAANNCCEE__AALLPPHHAA.
-
_t_y_p_e
-
Specifies the data type of the pixel data.
The following symbolic values are accepted:
GGLL__UUNNSSIIGGNNEEDD__BBYYTTEE,
GGLL__BBYYTTEE,
GGLL__BBIITTMMAAPP,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT,
GGLL__SSHHOORRTT,
GGLL__UUNNSSIIGGNNEEDD__IINNTT,
GGLL__IINNTT,
GGLL__FFLLOOAATT
GGLL__UUNNSSIIGGNNEEDD__BBYYTTEE__33__33__22,
GGLL__UUNNSSIIGGNNEEDD__BBYYTTEE__22__33__33__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__55__66__55,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__55__66__55__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__44__44__44__44,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__44__44__44__44__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__55__55__55__11,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__11__55__55__55__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__IINNTT__88__88__88__88,
GGLL__UUNNSSIIGGNNEEDD__IINNTT__88__88__88__88__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__IINNTT__1100__1100__1100__22, and
GGLL__UUNNSSIIGGNNEEDD__IINNTT__22__1100__1100__1100__RREEVV.
-
_p_i_x_e_l_s
-
Specifies a pointer to the image data in memory.
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 ggllEEnnaabbllee
and ggllDDiissaabbllee with argument GGLL__TTEEXXTTUURREE__33DD.
To define texture images, call ggllTTeexxIImmaaggee33DD.
The arguments describe the parameters of the texture image,
such as height,
width, depth,
width of the border,
level-of-detail number
(see ggllTTeexxPPaarraammeetteerr),
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 ggllDDrraawwPPiixxeellss.
If _t_a_r_g_e_t is GGLL__PPRROOXXYY__TTEEXXTTUURREE__33DD, no data is read from _p_i_x_e_l_s, 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 ggllGGeettEErrrroorr). To query for an
entire mipmap array, use an image array level greater than or equal to
1.
If _t_a_r_g_e_t is GGLL__TTEEXXTTUURREE__33DD,
data is read from _p_i_x_e_l_s as a sequence of signed or unsigned bytes,
shorts,
or longs,
or single-precision floating-point values,
depending on _t_y_p_e.
These values are grouped into sets of one,
two,
three,
or four values,
depending on _f_o_r_m_a_t,
to form elements.
If _t_y_p_e is GGLL__BBIITTMMAAPP,
the data is considered as a string of unsigned bytes (and
_f_o_r_m_a_t must be GGLL__CCOOLLOORR__IINNDDEEXX).
Each data byte is treated as eight 1-bit elements,
with bit ordering determined by GGLL__UUNNPPAACCKK__LLSSBB__FFIIRRSSTT
(see ggllPPiixxeellSSttoorree).
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.
_f_o_r_m_a_t determines the composition of each element in _p_i_x_e_l_s.
It can assume one of eleven symbolic values:
-
GGLL__CCOOLLOORR__IINNDDEEXX
-
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 GGLL__IINNDDEEXX__SSHHIIFFTT,
and added to GGLL__IINNDDEEXX__OOFFFFSSEETT
(see
ggllPPiixxeellTTrraannssffeerr).
The resulting index is converted to a set of color components
using the
GGLL__PPIIXXEELL__MMAAPP__II__TTOO__RR,
GGLL__PPIIXXEELL__MMAAPP__II__TTOO__GG,
GGLL__PPIIXXEELL__MMAAPP__II__TTOO__BB, and
GGLL__PPIIXXEELL__MMAAPP__II__TTOO__AA tables,
and clamped to the range [0,1].
-
GGLL__RREEDD
-
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 GGLL__cc__SSCCAALLEE,
added to the signed bias GGLL__cc__BBIIAASS,
and clamped to the range [0,1]
(see ggllPPiixxeellTTrraannssffeerr).
-
GGLL__GGRREEEENN
-
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 GGLL__cc__SSCCAALLEE,
added to the signed bias GGLL__cc__BBIIAASS,
and clamped to the range [0,1]
(see ggllPPiixxeellTTrraannssffeerr).
-
GGLL__BBLLUUEE
-
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 GGLL__cc__SSCCAALLEE,
added to the signed bias GGLL__cc__BBIIAASS,
and clamped to the range [0,1]
(see ggllPPiixxeellTTrraannssffeerr).
-
GGLL__AALLPPHHAA
-
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 GGLL__cc__SSCCAALLEE,
added to the signed bias GGLL__cc__BBIIAASS,
and clamped to the range [0,1]
(see ggllPPiixxeellTTrraannssffeerr).
-
GGLL__RRGGBB
-
-
GGLL__BBGGRR
-
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 GGLL__cc__SSCCAALLEE,
added to the signed bias GGLL__cc__BBIIAASS,
and clamped to the range [0,1]
(see
ggllPPiixxeellTTrraannssffeerr).
-
GGLL__RRGGBBAA
-
-
GGLL__BBGGRRAA
-
Each element contains all four components.
Each component is multiplied by the signed scale factor GGLL__cc__SSCCAALLEE,
added to the signed bias GGLL__cc__BBIIAASS,
and clamped to the range [0,1]
(see ggllPPiixxeellTTrraannssffeerr).
-
GGLL__LLUUMMIINNAANNCCEE
-
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 GGLL__cc__SSCCAALLEE,
added to the signed bias GGLL__cc__BBIIAASS,
and clamped to the range [0,1]
(see ggllPPiixxeellTTrraannssffeerr).
-
GGLL__LLUUMMIINNAANNCCEE__AALLPPHHAA
-
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 GGLL__cc__SSCCAALLEE,
added to the signed bias GGLL__cc__BBIIAASS,
and clamped to the range [0,1]
(see
ggllPPiixxeellTTrraannssffeerr).
Refer to the ggllDDrraawwPPiixxeellss reference page for a description of
the acceptable values for the _t_y_p_e parameter.
If an application wants to store the texture at a certain
resolution or in a certain , it can request the resolution
and with _i_n_t_e_r_n_a_l_F_o_r_m_a_t. The GL will choose an internal
representation that closely approximates that requested by _i_n_t_e_r_n_a_l_F_o_r_m_a_t, but
it may not match exactly.
(The representations specified by GGLL__LLUUMMIINNAANNCCEE,
GGLL__LLUUMMIINNAANNCCEE__AALLPPHHAA, GGLL__RRGGBB,
and GGLL__RRGGBBAA must match exactly. The numeric values 1, 2, 3, and 4
may also be used to specify the above representations.)
Use the GGLL__PPRROOXXYY__TTEEXXTTUURREE__33DD target to try out a resolution and
update and recompute its best match for the requested storage resolution
and . To then query this state, call
ggllGGeettTTeexxLLeevveellPPaarraammeetteerr.
If the texture cannot be accommodated, texture state is set to 0.
A one-component texture image uses only the red component of the RGBA
color extracted from _p_i_x_e_l_s.
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.
NOTES
Texturing has no effect in color index mode.
The texture image can be represented by the same data formats
as the pixels in a ggllDDrraawwPPiixxeellss command,
except that GGLL__SSTTEENNCCIILL__IINNDDEEXX and GGLL__DDEEPPTTHH__CCOOMMPPOONNEENNTT
cannot be used.
ggllPPiixxeellSSttoorree and ggllPPiixxeellTTrraannssffeerr modes affect texture images
in exactly the way they affect ggllDDrraawwPPiixxeellss.
ggllTTeexxIImmaaggee33DD is available only if the GL version is 1.2 or greater.
Internal formats other than 1, 2, 3, or 4 may be used only if the GL
version is 1.1 or greater.
_p_i_x_e_l_s may be a null pointer.
In this case texture memory is
allocated to accommodate a texture of width _w_i_d_t_h, height _h_e_i_g_h_t,
and depth _d_e_p_t_h.
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.
Formats GGLL__BBGGRR, and GGLL__BBGGRRAA and types
GGLL__UUNNSSIIGGNNEEDD__BBYYTTEE__33__33__22,
GGLL__UUNNSSIIGGNNEEDD__BBYYTTEE__22__33__33__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__55__66__55,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__55__66__55__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__44__44__44__44,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__44__44__44__44__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__55__55__55__11,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__11__55__55__55__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__IINNTT__88__88__88__88,
GGLL__UUNNSSIIGGNNEEDD__IINNTT__88__88__88__88__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__IINNTT__1100__1100__1100__22, and
GGLL__UUNNSSIIGGNNEEDD__IINNTT__22__1100__1100__1100__RREEVV are available only if the GL version
is 1.2 or greater.
When the GGLL__AARRBB__mmuullttiitteexxttuurree extension is supported, ggllTTeexxIImmaaggee33DD
specifies the three-dimensional texture for the current texture unit,
specified with ggllAAccttiivveeTTeexxttuurreeAARRBB.
If the GGLL__AARRBB__iimmaaggiinngg 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]:
-
1. Color component replacement by the color table specified for
-
GGLL__CCOOLLOORR__TTAABBLLEE, if enabled. See ggllCCoolloorrTTaabbllee.
-
2. Color component replacement by the color table specified for
-
GGLL__PPOOSSTT__CCOONNVVOOLLUUTTIIOONN__CCOOLLOORR__TTAABBLLEE, if enabled. See ggllCCoolloorrTTaabbllee.
-
3. Transformation by the color matrix. See ggllMMaattrriixxMMooddee.
-
-
4. RGBA components may be multiplied by GGLL__PPOOSSTT__CCOOLLOORR__MMAATTRRIIXX__cc__SSCCAALLEE,
-
and added to GGLL__PPOOSSTT__CCOOLLOORR__MMAATTRRIIXX__cc__BBIIAASS, if enabled. See
ggllPPiixxeellTTrraannssffeerr.
-
5. Color component replacement by the color table specified for
-
GGLL__PPOOSSTT__CCOOLLOORR__MMAATTRRIIXX__CCOOLLOORR__TTAABBLLEE, if enabled. See
ggllCCoolloorrTTaabbllee.
ERRORS
GGLL__IINNVVAALLIIDD__EENNUUMM is generated if _t_a_r_g_e_t is not GGLL__TTEEXXTTUURREE__33DD
or GGLL__PPRROOXXYY__TTEEXXTTUURREE__33DD.
GGLL__IINNVVAALLIIDD__EENNUUMM is generated if _f_o_r_m_a_t is not an accepted
constant.
Format constants other than GGLL__SSTTEENNCCIILL__IINNDDEEXX and GGLL__DDEEPPTTHH__CCOOMMPPOONNEENNTT
are accepted.
GGLL__IINNVVAALLIIDD__EENNUUMM is generated if _t_y_p_e is not a type constant.
GGLL__IINNVVAALLIIDD__EENNUUMM is generated if _t_y_p_e is GGLL__BBIITTMMAAPP and
_f_o_r_m_a_t is not GGLL__CCOOLLOORR__IINNDDEEXX.
GGLL__IINNVVAALLIIDD__VVAALLUUEE is generated if _l_e_v_e_l is less than 0.
GGLL__IINNVVAALLIIDD__VVAALLUUEE may be generated if _l_e_v_e_l is greater than $log
sub 2$_m_a_x,
where _m_a_x is the returned value of GGLL__MMAAXX__TTEEXXTTUURREE__SSIIZZEE.
GGLL__IINNVVAALLIIDD__VVAALLUUEE is generated if _i_n_t_e_r_n_a_l_F_o_r_m_a_t is not 1, 2, 3, 4, or one of the
accepted resolution and symbolic constants.
GGLL__IINNVVAALLIIDD__VVAALLUUEE is generated if _w_i_d_t_h, _h_e_i_g_h_t, or _d_e_p_t_h
is less than 0 or greater than 2 + GGLL__MMAAXX__TTEEXXTTUURREE__SSIIZZEE,
or if either cannot be represented as $2 sup k ~+~ 2( "border" )$ for some
integer value of _k.
GGLL__IINNVVAALLIIDD__VVAALLUUEE is generated if _b_o_r_d_e_r is not 0 or 1.
GGLL__IINNVVAALLIIDD__OOPPEERRAATTIIOONN is generated if ggllTTeexxIImmaaggee33DD
is executed between the execution of ggllBBeeggiinn
and the corresponding execution of ggllEEnndd.
GGLL__IINNVVAALLIIDD__OOPPEERRAATTIIOONN is generated if _t_y_p_e is one of
GGLL__UUNNSSIIGGNNEEDD__BBYYTTEE__33__33__22,
GGLL__UUNNSSIIGGNNEEDD__BBYYTTEE__22__33__33__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__55__66__55, or
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__55__66__55__RREEVV
and _f_o_r_m_a_t is not GGLL__RRGGBB.
GGLL__IINNVVAALLIIDD__OOPPEERRAATTIIOONN is generated if _t_y_p_e is one of
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__44__44__44__44,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__44__44__44__44__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__55__55__55__11,
GGLL__UUNNSSIIGGNNEEDD__SSHHOORRTT__11__55__55__55__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__IINNTT__88__88__88__88,
GGLL__UUNNSSIIGGNNEEDD__IINNTT__88__88__88__88__RREEVV,
GGLL__UUNNSSIIGGNNEEDD__IINNTT__1100__1100__1100__22, or
GGLL__UUNNSSIIGGNNEEDD__IINNTT__22__1100__1100__1100__RREEVV
and _f_o_r_m_a_t is neither GGLL__RRGGBBAA nor GGLL__BBGGRRAA.
ASSOCIATED GETS
ggllGGeettTTeexxIImmaaggee
ggllIIssEEnnaabblleedd with argument GGLL__TTEEXXTTUURREE__33DD
SEE ALSO
ggllAAccttiivveeTTeexxttuurreeAARRBB((33GG)),
ggllCCooppyyPPiixxeellss((33GG)),
ggllCCooppyyTTeexxIImmaaggee11DD((33GG)),
ggllCCooppyyTTeexxIImmaaggee22DD((33GG)),
ggllCCooppyyTTeexxSSuubbIImmaaggee11DD((33GG)),
ggllCCooppyyTTeexxSSuubbIImmaaggee22DD((33GG)),
ggllCCooppyyTTeexxSSuubbIImmaaggee33DD((33GG)),
ggllDDrraawwPPiixxeellss((33GG)),
ggllPPiixxeellSSttoorree((33GG)),
ggllPPiixxeellTTrraannssffeerr((33GG)),
ggllTTeexxEEnnvv((33GG)),
ggllTTeexxGGeenn((33GG)),
ggllTTeexxIImmaaggee11DD((33GG)),
ggllTTeexxIImmaaggee22DD((33GG)),
ggllTTeexxSSuubbIImmaaggee11DD((33GG)),
ggllTTeexxSSuubbIImmaaggee22DD((33GG)),
ggllTTeexxSSuubbIImmaaggee33DD((33GG)),
ggllTTeexxPPaarraammeetteerr((33GG))