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

compressedTexSubImage2D method

Specifies a two-dimensional texture or cube Map sub-image from compressed image data. You must call getExtension("WEBGL_compressed_texture_s3tc") to enable compressed textures before calling this method.

IE11

 

Syntax

WebGLRenderingContext.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, data);

Parameters

target [in]

Type: Number

The target texture. 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 map.

gl.TEXTURE_CUBE_MAP_NEGATIVE_X

Image for the negative X face of the cube map.

gl.TEXTURE_CUBE_MAP_POSITIVE_Y

Image for the positive Y face of the cube map.

gl.TEXTURE_CUBE_MAP_NEGATIVE_Y

Image for the negative Y face of the cube map.

gl.TEXTURE_CUBE_MAP_POSITIVE_Z

Image for the positive Z face of the cube map.

gl.TEXTURE_CUBE_MAP_NEGATIVE_Z

Image for the negative Z face of the cube map.

 

level [in]

Type: Number

The level of detail. Level 0 equals the base image level. Only level 0 is supported in IE11.

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.

width [in]

Type: Number

The width of the subimage texture.

height [in]

Type: Number

The height of the subimage texture.

format [in]

Type: Number

The format or extension of the compressed image. This must be the same format specified previously by compressedTexImage2D. Possible values:

ValueMeaning
COMPRESSED_RGB_S3TC_DXT1_EXT

The byteLength of data (ArrayBufferView) in pixels that's passed must be match the equation floor((width + 3) / 4) * floor((height + 3) / 4) * 8

COMPRESSED_RGBA_S3TC_DXT1_EXT

The byteLength of data (ArrayBufferView) in pixels that's passed must be match the equation floor((width + 3) / 4) * floor((height + 3) / 4) * 8

COMPRESSED_RGBA_S3TC_DXT3_EXT

The byteLength of data (ArrayBufferView) in pixels that's passed must be match the equation floor((width + 3) / 4) * floor((height + 3) / 4) * 16

COMPRESSED_RGBA_S3TC_DXT5_EXT

The byteLength of data (ArrayBufferView) in pixels that's passed must be match the equation floor((width + 3) / 4) * floor((height + 3) / 4) * 16

 

data [in]

Type: ArrayBufferView

Object that contains the image data.

Return value

This method does not return a value.

Remarks

WebGL errorDescription
gl.INVALID_VALUEIf internalFormat does not equal one of the specified values.
gl.INVALID_OPERATIONIf width or height are not a multiple of 4.
gl.INVALID_OPERATIONIf xoffset or yoffset are not a multiple of 4, and width or height are not multiples of 4 or equal to the original width and height of level.

 

See also

WebGLRenderingContext
compressedTexImage2D

 

 

Show:
© 2015 Microsoft