Constructor
new Shader(fragmentCode)
Create a shader from a fragment snippet that defines void mainImage(out vec4 c, vec2 uv)
Parameters:
| Name | Type | Description |
|---|---|---|
fragmentCode | string |
- Source
Example
const fade = new Shader(`
void mainImage(out vec4 c, vec2 uv)
{
c = texture(iChannel0, uv);
c.a *= .5 + .5*sin(iTime);
}`);
obj.shader = fade;Members
fragmentCode
Properties| Type | Description |
|---|---|
| string | The mainImage snippet |
- Source
program :WebGLProgram|undefined
Type:
Properties- WebGLProgram |
undefined
| Type | Description |
|---|---|
| WebGLProgram | | The 2D program, compiled by the first draw that needs it, read only |
- Source
program3D :WebGLProgram|undefined
Type:
Properties- WebGLProgram |
undefined
| Type | Description |
|---|---|
| WebGLProgram | | The 3D program, compiled by the 3D plugin the same way, read only |
- Source