A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/compressedTexImage2D below:

WebGLRenderingContext: compressedTexImage2D() method - Web APIs

WebGLRenderingContext: compressedTexImage2D() method

Baseline Widely available *

Note: This feature is available in Web Workers.

The compressedTexImage2D() method of the WebGLRenderingContext interface of the WebGL API specifies a two-dimensional texture image in a compressed format.

Compressed image formats must be enabled by WebGL extensions before using these methods.

Syntax
// WebGL 1:
compressedTexImage2D(target, level, internalformat, width, height, border)
compressedTexImage2D(target, level, internalformat, width, height, border, pixels)

// Additionally available in WebGL 2:
// read from buffer bound to gl.PIXEL_UNPACK_BUFFER
compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, offset)
compressedTexImage2D(target, level, internalformat, width, height, border, srcData)
compressedTexImage2D(target, level, internalformat, width, height, border, srcData, srcOffset)
compressedTexImage2D(target, level, internalformat, width, height, border, srcData, srcOffset, srcLengthOverride)
Parameters
target

A GLenum specifying the binding point (target) of the active texture. Possible values for compressedTexImage2D:

level

A GLint specifying the level of detail. Level 0 is the base image level and level n is the n-th mipmap reduction level.

internalformat

A GLenum specifying the compressed image format. Compressed image formats must be enabled by WebGL extensions before using this method. All values are possible for compressedTexImage2D. Possible values:

width

A GLsizei specifying the width of the texture.

height

A GLsizei specifying the height of the texture.

depth

A GLsizei specifying the depth of the texture/the number of textures in a TEXTURE_2D_ARRAY.

border

A GLint specifying the width of the border. Must be 0.

imageSize

A GLsizei specifying the number of bytes to read from the buffer bound to gl.PIXEL_UNPACK_BUFFER.

offset

A GLintptr specifying the offset in bytes from which to read from the buffer bound to gl.PIXEL_UNPACK_BUFFER.

pixels

A TypedArray or a DataView that will be used as a data store for the compressed image data in memory.

Return value

None (undefined).

Examples
const ext =
  gl.getExtension("WEBGL_compressed_texture_s3tc") ||
  gl.getExtension("MOZ_WEBGL_compressed_texture_s3tc") ||
  gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");

const texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.compressedTexImage2D(
  gl.TEXTURE_2D,
  0,
  ext.COMPRESSED_RGBA_S3TC_DXT5_EXT,
  512,
  512,
  0,
  textureData,
);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4