Class: SamplerCube

SamplerCube

Stores a WebGL texture unit index, and a WebGL texture to be bound to it. May reflect an ESSL samplerCube uniform variable.

new SamplerCube(textureUnit)

Creates object.
Parameters:
Name Type Description
textureUnit Number The texture unit index. This should be different for every texture used in the same program, and less than the maximum texture unit count, which is at least 8 in WebGL.

Methods


commit(gl, uniformLocation)

Sets the value of the texture unit index to the WebGL samplerCube uniform variable, and binds the texture to the corresponding texture unit.
Parameters:
Name Type Description
gl WebGLRenderingContext rendering context
uniformLocation WebGLUniformLocation location of the uniform variable in the currently used WebGL program

set(texture)

Assigns a texture.
Parameters:
Name Type Description
texture Object | WebGLTexture A WebGL texture, or any object with the `glTexture` property that stores a WebGL texture.