EN
Данное содержимое не доступно на вашем языке, используйте версию на английском языке.

compressedTexImage2D method

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

IE11

 

Syntax

WebGLRenderingContext.compressedTexImage2D(target, level, internalformat, width, height, border, 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.

internalformat [in]

Type: Number

The image format of the compressed image stored in memory. Use one of the following:

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

 

width [in]

Type: Number

The width of the texture image. A 2D texture image needs to be at least 64 texels wide, and cube-mapped texture images should be 16 texels wide.

height [in]

Type: Number

The height of the texture image. A 2D texture image needs to be at least 64 texels high, and cube-mapped texture images should be 16 texels high.

border [in]

Type: Number

Width of border. Always 0.

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_ENUMIf target isn't one of the specified values.
gl.INVALID_ENUMIf internalFormat isn't a supported format.
gl.INVALID_VALUEIf width or width is less than 0 or greater than gl.MAX_TEXTURE_SIZE.
gl.INVALID_VALUEIf border is not 0.

 

See also

WebGLRenderingContext

 

 

Показ:
© 2014 Microsoft