The WebGLRenderingContext.compressedTexSubImage2D()
method of the WebGL API specifies a two-dimensional sub-rectangle for a texture image in a compressed format.
Compressed image formats must be enabled by WebGL extensions before using this method or a WebGL2RenderingContext
must be used.
compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, srcData)
compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, offset)
compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, srcData)
compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, srcData, srcOffset)
compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, srcData, srcOffset, srcLengthOverride)
const ext =
gl.getExtension("WEBGL_compressed_texture_s3tc") ||
gl.getExtension("MOZ_WEBGL_compressed_texture_s3tc") ||
gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
gl.compressedTexSubImage2D(
gl.TEXTURE_2D,
0,
256,
256,
512,
512,
ext.COMPRESSED_RGBA_S3TC_DXT5_EXT,
textureData,
);