Gl.TexSubImage2D (gb.opengl)
Static Sub TexSubImage2D ( Image As Image, XOffset As Integer, YOffset As Integer, Width As Integer, Height As Integer [ , Level As Integer ] )
Since 3.6
Specify a two-dimensional texture subimage.
Parameters
- target
-
Specifies the target texture.
Must be Gl.TEXTURE_2D,
Gl.TEXTURE_CUBE_MAP_POSITIVE_X,
Gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
Gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
Gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
Gl.TEXTURE_CUBE_MAP_POSITIVE_Z, or
Gl.TEXTURE_CUBE_MAP_NEGATIVE_Z.
- level
-
Specifies the level-of-detail number.
Level 0 is the base image level.
Level n is the nth mipmap reduction image.
- xoffset
-
Specifies a texel offset in the x direction within the texture array.
- yoffset
-
Specifies a texel offset in the y direction within the texture array.
- width
-
Specifies the width of the texture subimage.
- height
-
Specifies the height of the texture subimage.
- format
-
Specifies the format of the pixel data.
The following symbolic values are accepted:
Gl.RED,
Gl.RG,
Gl.RGB,
Gl.BGR,
Gl.RGBA, and
Gl.BGRA.
- type
-
Specifies the data type of the pixel data.
The following symbolic values are accepted:
Gl.UNSIGNED_BYTE,
Gl.BYTE,
Gl.UNSIGNED_SHORT,
Gl.SHORT,
Gl.UNSIGNED_INT,
Gl.INT,
Gl.FLOAT,
Gl.UNSIGNED_BYTE_3_3_2,
Gl.UNSIGNED_BYTE_2_3_3_REV,
Gl.UNSIGNED_SHORT_5_6_5,
Gl.UNSIGNED_SHORT_5_6_5_REV,
Gl.UNSIGNED_SHORT_4_4_4_4,
Gl.UNSIGNED_SHORT_4_4_4_4_REV,
Gl.UNSIGNED_SHORT_5_5_5_1,
Gl.UNSIGNED_SHORT_1_5_5_5_REV,
Gl.UNSIGNED_INT_8_8_8_8,
Gl.UNSIGNED_INT_8_8_8_8_REV,
Gl.UNSIGNED_INT_10_10_10_2, and
Gl.UNSIGNED_INT_2_10_10_10_REV.
- data
-
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 two-dimensional texturing, call Gl.Enable
and Gl.Disable with argument
Gl.TEXTURE_2D.
Gl.TexSubImage2D redefines a contiguous subregion of an existing two-dimensional
texture image.
The texels referenced by
data replace the portion of the
existing texture array with x indices
xoffset and
,
inclusive,
and y indices
yoffset and
,
inclusive.
This region may not include any texels outside the range of the
texture array as it was originally specified.
It is not an error to specify a subtexture with zero width or height, but
such a specification has no effect.
If a non-zero named buffer object is bound to the Gl.PIXEL_UNPACK_BUFFER target
(see Gl.BindBuffer) while a texture image is
specified,
data is treated as a byte offset into the buffer object's data store.
Notes
Gl.PixelStore modes affect texture images.
Gl.TexSubImage2D specifies a two-dimensional subtexture for the current texture unit,
specified with
Gl.ActiveTexture.
Errors
Gl.INVALID_ENUM is generated if
target is not
Gl.TEXTURE_2D,
Gl.TEXTURE_CUBE_MAP_POSITIVE_X,
Gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
Gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
Gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
Gl.TEXTURE_CUBE_MAP_POSITIVE_Z, or
Gl.TEXTURE_CUBE_MAP_NEGATIVE_Z.
Gl.INVALID_ENUM is generated if
format is not an accepted
format constant.
Gl.INVALID_ENUM is generated if
type is not a type constant.
Gl.INVALID_VALUE is generated if
level is less than 0.
Gl.INVALID_VALUE may be generated if
level is greater
than
max,
where
max is the returned value of
Gl.MAX_TEXTURE_SIZE.
Gl.INVALID_VALUE is generated if
,
,
,
or
,
where
is the
Gl.TEXTURE_WIDTH,
is the
Gl.TEXTURE_HEIGHT, and
is the border width
of the texture image being modified.
Note that
and
include twice the border width.
Gl.INVALID_VALUE is generated if
width or
height is less than 0.
Gl.INVALID_OPERATION is generated if the texture array has not
been defined by a previous
Gl.TexImage2D operation.
Gl.INVALID_OPERATION is generated if
type is one of
Gl.UNSIGNED_BYTE_3_3_2,
Gl.UNSIGNED_BYTE_2_3_3_REV,
Gl.UNSIGNED_SHORT_5_6_5, or
Gl.UNSIGNED_SHORT_5_6_5_REV
and
format is not
Gl.RGB.
Gl.INVALID_OPERATION is generated if
type is one of
Gl.UNSIGNED_SHORT_4_4_4_4,
Gl.UNSIGNED_SHORT_4_4_4_4_REV,
Gl.UNSIGNED_SHORT_5_5_5_1,
Gl.UNSIGNED_SHORT_1_5_5_5_REV,
Gl.UNSIGNED_INT_8_8_8_8,
Gl.UNSIGNED_INT_8_8_8_8_REV,
Gl.UNSIGNED_INT_10_10_10_2, or
Gl.UNSIGNED_INT_2_10_10_10_REV
and
format is neither
Gl.RGBA nor
Gl.BGRA.
Gl.INVALID_OPERATION is generated if a non-zero buffer object name is bound to the
Gl.PIXEL_UNPACK_BUFFER target and the buffer object's data store is currently mapped.
Gl.INVALID_OPERATION is generated if a non-zero buffer object name is bound to the
Gl.PIXEL_UNPACK_BUFFER target and the data would be unpacked from the buffer
object such that the memory reads required would exceed the data store size.
Gl.INVALID_OPERATION is generated if a non-zero buffer object name is bound to the
Gl.PIXEL_UNPACK_BUFFER target and
data is not evenly divisible
into the number of bytes needed to store in memory a datum indicated by
type.
Associated Gets
Gl.GetTexImage
Gl.Get with argument Gl.PIXEL_UNPACK_BUFFER_BINDING
See also
Gl.CopyTexSubImage1D
Gl.CopyTexSubImage2D
Gl.CopyTexSubImage3D
Gl.PixelStore
Gl.TexImage3D
Gl.TexSubImage3D
Gl.TexParameter
See original documentation on OpenGL website