files/en-us/web/api/webglrenderingcontext/copytexsubimage2d/index.md
{{APIRef("WebGL")}}{{AvailableInWorkers}}
The copyTexSubImage2D() method of the {{domxref("WebGLRenderingContext")}} interface of the WebGL API copies pixels from the current {{domxref("WebGLFramebuffer")}} into a 2D texture sub-image.
copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height)
target
gl.TEXTURE_2D: A two-dimensional texture.gl.TEXTURE_CUBE_MAP_POSITIVE_X: Positive X face for a cube-mapped texture.gl.TEXTURE_CUBE_MAP_NEGATIVE_X: Negative X face for a cube-mapped texture.gl.TEXTURE_CUBE_MAP_POSITIVE_Y: Positive Y face for a cube-mapped texture.gl.TEXTURE_CUBE_MAP_NEGATIVE_Y: Negative Y face for a cube-mapped texture.gl.TEXTURE_CUBE_MAP_POSITIVE_Z: Positive Z face for a cube-mapped texture.gl.TEXTURE_CUBE_MAP_NEGATIVE_Z: Negative Z face for a cube-mapped texture.level
xoffset
yoffset
x
y
width
height
None ({{jsxref("undefined")}}).
gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, 16, 16);
{{Specifications}}
{{Compat}}