Click or drag to resize

TextureSubUploadT Method (glPixelFormat, Int32, Int32, Int32, Int32, T, Int32, glPixelDataType, Int32)

Uploads a part of an image to the texture.

Namespace:  Ooogles
Assembly:  Ooogles (in Ooogles.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public void SubUpload<T>(
	glPixelFormat format,
	int xOffset,
	int yOffset,
	int width,
	int height,
	T[,] data,
	int level = 0,
	glPixelDataType type = glPixelDataType.UnsignedByte,
	int cubeTarget = 0
)
where T : struct, new()

Parameters

format
Type: OooglesglPixelFormat
the format of the texel data.
xOffset
Type: SystemInt32
texel offset in the X direction within the texture array.
yOffset
Type: SystemInt32
texel offset in the Y direction within the texture array.
width
Type: SystemInt32
the width of the texture subimage.
height
Type: SystemInt32
the height of the texture subimage.
data
Type: T
two-dimensional array with the image data in memory.
level (Optional)
Type: SystemInt32
(optional) level-of-detail number if updating separate mipmap levels. Level 0 (default) is the base image level. Level N is the Nth mipmap reduction image.
type (Optional)
Type: OooglesglPixelDataType
(optional) data type the texel data. Defaults to UnsignedByte.
cubeTarget (Optional)
Type: SystemInt32
(optional) if this texture is a cube texture, then this parameter specifies which of the 6 cube faces to update. This parameter is ignored for 2D textures.

Type Parameters

T
the type of data in the data array
Exceptions
ExceptionCondition
GLExceptionInvalidValue if level is less than 0 or greater than the maximum level.
GLExceptionInvalidValue if xOffset < 0 or xOffset + width is greater than the width of this texture.
GLExceptionInvalidValue if yOffset < 0 or yOffset + height is greater than the height of this texture.
GLExceptionInvalidValue if width or height is less than 0.
GLExceptionInvalidOperation if the texture array has not been defined by a previous UploadT(glPixelFormat, Int32, Int32, T, Int32, glPixelDataType, Int32), Reserve(glPixelFormat, Int32, Int32, Int32, glPixelDataType, Int32) or Copy(glPixelFormat, Int32, Int32, Int32, Int32, Int32, Int32) operation whose format matches the format parameter of this method.
GLExceptionInvalidOperation if type is UnsignedShort565 and format is not Rgb.
GLExceptionInvalidOperation if type is UnsignedShort4444 or UnsignedShort5551 and format is not Rgba.
Remarks
This updates the texture in memory.

This method 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 xOffset + width - 1, inclusive, and Y indices yOffset and yOffset + height - 1, 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.

Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.

OpenGL API: glTexSubImage2D

See Also

Reference