Graphics Reference
In-Depth Information
This function will update the region of texels in the range (
xoffset
,
yoffset
)
to (
xoffset
+
width
- 1,
yoffset
+
height
- 1). Note that to use this function,
the texture must already be fully specified. The range of the subimage
must be within the bounds of the previously specified texture image. The
data in the
pixels
array must be aligned to the alignment that is specified
by
GL_UNPACK_ALIGNMENT
with
glPixelStorei
.
There is also a function for updating a subregion of a compressed 2D
texture image—that is,
glCompressedTexSubImage2D
. The definition for
this function is more or less the same as that for
glTexImage2D
.
void
glCompressedTexSubImage2D
(GLenum
target
,
GLint
level
, GLint
xoffset
,
GLint
yoffset
, GLsizei
width
,
GLsizei
height
,
GLenum
format
,
GLenum
imageSize
,
const void*
pixels
)
specifies the texture target, either
GL_TEXTURE_2D
or one of
the cubemap face targets
(
GL_TEXTURE_CUBE_MAP_POSITIVE_X
,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X
, and so on)
target
specifies which mip level to update
level
the
x
index of the texel to start updating from
xoffset
the
y
index of the texel to start updating from
yoffset
the width of the subregion of the image to update
width
the height of the subregion of the image to update
height
the compressed texture format to use; must be
the format with which the image was originally specified
format
contains the actual pixel data for the subregion of the image
pixels
In addition, as with 2D textures, it is possible to update just a subregion of
an existing 3D texture and 2D texture arrays using
glTexSubImage3D
.
void
glTexSubImage3D
(GLenum
target
, GLint
level
,
GLint
xoffset
, GLint
yoffset
,
GLint
zoffset
, GLsizei
width
,
GLsizei
height
, GLsizei
depth
,
GLenum
format
, GLenum
type
,
const void*
pixels
)
(continues)