Phaser API Documentation

  Version: 
setShader(key, [textures], [textureData])

Description:

Sets the fragment and, optionally, the vertex shader source code that this Shader will use. This will immediately delete the active shader program, if set, and then create a new one with the given source. Finally, the shader uniforms are initialized.

Parameters:

name type arguments description
key string | Phaser.Display.BaseShader

The key of the shader to use from the shader cache, or a BaseShader instance.

textures Array.<string> <optional>

Optional array of texture keys to bind to the iChannel0...3 uniforms. The textures must already exist in the Texture Manager.

textureData any <optional>

Additional texture data.

Returns:
Description:

This Shader instance.

Since: 3.17.0