Phaser API Documentation

  Version: 
setSampler2D(uniformKey, textureKey, [textureIndex], [textureData])

Description:

Sets a sampler2D uniform on this shader.

The textureKey given is the key from the Texture Manager cache. You cannot use a single frame from a texture, only the full image. Also, lots of shaders expect textures to be power-of-two sized.

If you wish to use another Shader as a sampler2D input for this shader, see the Shader.setSampler2DBuffer method.

Parameters:

name type arguments description
uniformKey string

The key of the sampler2D uniform to be updated, i.e. iChannel0.

textureKey string

The key of the texture, as stored in the Texture Manager. Must already be loaded.

textureIndex number <optional>

The texture index.

textureData any <optional>

Additional texture data.

Returns:
Description:

This Shader instance.

Since: 3.17.0