Sets the p5.Shader object to apply for images.
This method allows the user to apply a custom shader to images, enabling advanced visual effects such as pixel manipulation, color adjustments, or dynamic behavior. The shader will be applied to the image drawn using the image() function.
The shader will be used exclusively for:
image()
calls, applying only when drawing 2D images.- This shader will NOT apply to images used in texture() or other 3D contexts. Any attempts to use the imageShader in these cases will be ignored.
Examples
Syntax
imageShader(s)
Parameters
s
p5.Shader: p5.Shader object to apply for images.
Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/material.js and open a pull request!
Related References
copyToContext
Copies the shader from one drawing context to another.
inspectHooks
Logs the hooks available in this shader, and their current implementation.
modify
Returns a new shader, based on the original, but with custom snippets of shader code replacing default behaviour.
setUniform
Sets the shader’s uniform (global) variables.