Class: Sampler2DArray

Sampler2DArray

Array of 2d samplers. May reflect an ESSL array-of-sampler2Ds uniform variable.
Individual Sampler2D elements are available through the index operator [].

new Sampler2DArray(size, baseTextureUnit)

Parameters:
Name Type Description
size Number The number of Sampler2D elements in the array.
baseTextureUnit Number The texture unit index of the first element. Other elements are assigned to texture units contiguously.

Methods


at(index)

Returns a Sampler2D object that captures an element of the array. The sampler is a view on the original data, not a copy.
Parameters:
Name Type Description
index Number Index of the element.
Returns:
view on one of the array's elements
Type
SamplerCube

commit(gl, uniformLocation)

Specifies, to WebGL, the texture unit indices of all samplers in the array, and binds textures of the array elements.
Parameters:
Name Type Description
gl WebGLRenderingContext rendering context
uniformLocation WebGLUniformLocation location of the uniform variable in the currently used WebGL program

set(textureArray)

Assigns textures.
Parameters:
Name Type Description
textureArray Array.<Object> | Array.<WebGLTexture> An array of WebGL textures, or of objects with the `glTexture` property that stores a WebGL texture.