WebGL2RenderingContext: texStorage2D() method

Note: This feature is available in Web Workers.

The texStorage2D() method of the WebGL2RenderingContext of the WebGL API specifies all levels of two-dimensional texture storage.

Syntax

js
texStorage2D(target, levels, internalformat, width, height)

Parameters

target

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

levels

A GLint specifying the number of texture levels.

internalformat

A GLenum specifying the texture store format. Possible values:

Unlike OpenGL 3.0, WebGL 2 doesn't support the following ETC2 and EAC compressed texture formats (see section 5.37 in the WebGL 2 spec). You might be able to enable them via the WEBGL_compressed_texture_etc extension, though.

For the description of these formats, see WebGLRenderingContext.texImage2D(). Because texStorage2D does not actually specify a buffer source, the format and type parameters are irrelevant, and can be considered to be any of the valid values corresponding to the internalformat.

width

A GLsizei specifying the width of the texture in texels.

height

A GLsizei specifying the height of the texture in texels.

Return value

None (undefined).

Examples

js
gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGB8, 256, 256);

Specifications

See also