Sets a sampler2D uniform on this shader where the source texture is a WebGLTextureBuffer.
This allows you to feed the output from one Shader into another:
let shader1 = this.add.shader(baseShader1, 0, 0, 512, 512).setRenderToTexture();
let shader2 = this.add.shader(baseShader2, 0, 0, 512, 512).setRenderToTexture('output');
shader1.setSampler2DBuffer('iChannel0', shader2.glTexture, 512, 512);
shader2.setSampler2DBuffer('iChannel0', shader1.glTexture, 512, 512);
In the above code, the result of baseShader1 is fed into Shader2 as the iChannel0
sampler2D uniform.
The result of baseShader2 is then fed back into shader1 again, creating a feedback loop.
If you wish to use an image from the Texture Manager as a sampler2D input for this shader,
see the Shader.setSampler2D
method.
name | type | arguments | description |
---|---|---|---|
uniformKey | string |
The key of the sampler2D uniform to be updated, i.e. |
|
texture | Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper |
A texture reference. |
|
width | number |
The width of the texture. |
|
height | number |
The height of the texture. |
|
textureIndex | number | <optional> |
The texture index. |
textureData | any | <optional> |
Additional texture data. |
This Shader instance.