Create a filter from user-provided GLSL.
The source is inserted as the body of main(). You have access to:
source
uniforms
Write your result to gl_FragColor.
Example: customShader({ source: vec4 color = texture2D(u_texture, v_texCoord); gl_FragColor = vec4(color.r, 0.0, 0.0, color.a); , uniforms: {}, })
vec4 color = texture2D(u_texture, v_texCoord); gl_FragColor = vec4(color.r, 0.0, 0.0, color.a);
Create a filter from user-provided GLSL.
The
sourceis inserted as the body of main(). You have access to:uniformsparameterWrite your result to gl_FragColor.
Example: customShader({ source:
vec4 color = texture2D(u_texture, v_texCoord); gl_FragColor = vec4(color.r, 0.0, 0.0, color.a);, uniforms: {}, })