new Sampler2D(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 sampler2d 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.