files/en-us/web/api/webgl2renderingcontext/texsubimage3d/index.md
{{APIRef("WebGL")}}{{AvailableInWorkers}}
The texSubImage3D() method of the {{domxref("WebGL2RenderingContext")}} interface of the WebGL API specifies a three-dimensional sub-rectangle for a texture image.
texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData)
texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData, srcOffset)
texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, source)
texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, offset)
target
gl.TEXTURE_3D: A three-dimensional texture.gl.TEXTURE_2D_ARRAY: A two-dimensional array texture.level
xoffset
yoffset
zoffset
width
height
depth
TEXTURE_2D_ARRAY.format
type
format and type available, see {{domxref("WebGLRenderingContext.texSubImage2D()")}}.The texture source can be provided in one of three ways: from an {{jsxref("ArrayBuffer")}} (possibly shared) using srcData and srcOffset; from a DOM pixel source; or from gl.PIXEL_UNPACK_BUFFER using offset.
srcData
type parameter; see {{domxref("WebGLRenderingContext.texImage2D()")}}.srcOffset {{optional_inline}}
srcData to start reading from. Defaults to 0.source
offset
gl.PIXEL_UNPACK_BUFFER.None ({{jsxref("undefined")}}).
gl.texSubImage3D(
gl.TEXTURE_3D,
0,
0,
0,
0,
image.width,
image.height,
1,
gl.RGBA,
gl.UNSIGNED_BYTE,
image,
);
{{Specifications}}
{{Compat}}