 | Texture.SubUpload<T> Method (gl.PixelFormat, Int32, Int32, Int32, Int32,T[,], Int32, gl.PixelDataType, 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)
Syntaxpublic void SubUpload<T>(
gl.PixelFormat format,
int xOffset,
int yOffset,
int width,
int height,
T[,] data,
int level = 0,
gl.PixelDataType type = gl.PixelDataType.UnsignedByte,
int cubeTarget = 0
)
where T : struct, new()
Public Sub SubUpload(Of T As {Structure, New}) (
format As gl.PixelFormat,
xOffset As Integer,
yOffset As Integer,
width As Integer,
height As Integer,
data As T(,),
Optional level As Integer = 0,
Optional type As gl.PixelDataType = gl.PixelDataType.UnsignedByte,
Optional cubeTarget As Integer = 0
)
public:
generic<typename T>
where T : value class, gcnew()
void SubUpload(
gl.PixelFormat format,
int xOffset,
int yOffset,
int width,
int height,
array<T,2>^ data,
int level = 0,
gl.PixelDataType type = gl.PixelDataType::UnsignedByte,
int cubeTarget = 0
)
member SubUpload :
format : gl.PixelFormat *
xOffset : int *
yOffset : int *
width : int *
height : int *
data : 'T[,] *
?level : int *
?type : gl.PixelDataType *
?cubeTarget : int
(* Defaults:
let _level = defaultArg level 0
let _type = defaultArg type gl.PixelDataType.UnsignedByte
let _cubeTarget = defaultArg cubeTarget 0
*)
-> unit when 'T : struct, new()
Parameters
- format
- Type: Ooogles.gl.PixelFormat
the format of the texel data. - xOffset
- Type: System.Int32
texel offset in the X direction within the texture array. - yOffset
- Type: System.Int32
texel offset in the Y direction within the texture array. - width
- Type: System.Int32
the width of the texture subimage. - height
- Type: System.Int32
the height of the texture subimage. - data
- Type:T[,]
two-dimensional array with the image data in memory. - level (Optional)
- Type: System.Int32
(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: Ooogles.gl.PixelDataType
(optional) data type the texel data. Defaults to UnsignedByte. - cubeTarget (Optional)
- Type: System.Int32
(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
ExceptionsException | Condition |
---|
GLException | InvalidValue if level is less than 0 or greater than the maximum level. |
GLException | InvalidValue if xOffset < 0 or xOffset + width is greater than the width of this texture. |
GLException | InvalidValue if yOffset < 0 or yOffset + height is greater than the height of this texture. |
GLException | InvalidValue if width or height is less than 0. |
GLException | InvalidOperation if the texture array has not been defined by a previous Upload<T>(gl.PixelFormat, Int32, Int32,T[], Int32, gl.PixelDataType, Int32),
Reserve(gl.PixelFormat, Int32, Int32, Int32, gl.PixelDataType, Int32) or Copy(gl.PixelFormat, Int32, Int32, Int32, Int32, Int32, Int32) operation
whose format matches the format parameter of this method. |
GLException | InvalidOperation if type is UnsignedShort565 and format is not Rgb. |
GLException | InvalidOperation 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