Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

copyTexSubImage2D method

Replaces a portion of an existing 2D texture image with data from the current framebuffer.

IE11

 

Syntax

WebGLRenderingContext.copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);

Parameters

target [in]

Type: Number

One of the following:

ValueMeaning
gl.TEXTURE_2D

Uses a 2D image.

gl.TEXTURE_CUBE_MAP_POSITIVE_X

Image for the positive X face of the cube.

gl.TEXTURE_CUBE_MAP_NEGATIVE_X

Image for the negative X face of the cube.

gl.TEXTURE_CUBE_MAP_POSITIVE_Y

Image for the positive Y face of the cube.

gl.TEXTURE_CUBE_MAP_NEGATIVE_Y

Image for the negative Y face of the cube.

gl.TEXTURE_CUBE_MAP_POSITIVE_Z

Image for the positive Z face of the cube.

gl.TEXTURE_CUBE_MAP_NEGATIVE_Z

Image for the negative Z face of the cube.

 

level [in]

Type: Number

The level of detail. Level 0 equals the base image level. Additional levels (n) equal the nth mipmap reduction image. See generateMipmap to create mipmaps.

xoffset [in]

Type: Number

The horizontal offset of the image in the texture array.

yoffset [in]

Type: Number

The vertical offset of the image in the texture array.

x [in]

Type: Number

Horizontal coordinate of the lower left corner of the pixels to copy.

y [in]

Type: Number

Vertical coordinate of the lower left corner of the pixels to copy.

width [in]

Type: Number

The width of the texture subimage.

height [in]

Type: Number

The height of the texture subimage.

Return value

This method does not return a value.

Remarks

CopyTexImage2D doesn't support floating point texture sources or destinations.

WebGL errorDescription
gl.INVALID_ENUMValue of target is not one of the specified constants.
gl.INVALID_VALUE
  • The value of level is < 0.
  • If xoffset is < 0.
  • If yoffset is < 0.
  • If xoffset + width is greater than the width of the image being modified.
  • If yoffset + height is greater than the height of the image being modified.
  • If width or if height is < 0.
gl.INVALID_OPERATIONNo WebGLTexture is bound.
gl.INVALID_FRAMEBUFFER_OPERATION

 

See also

WebGLRenderingContext
copyTexImage2D

 

 

Show:
© 2015 Microsoft