patriciogonzalezvivo / glslCanvas

Simple tool to load GLSL shaders on HTML Canvas using WebGL
http://patriciogonzalezvivo.github.io/glslCanvas/
MIT License
1.95k stars 177 forks source link

Multiple shader passes #75

Open moritzsalla opened 2 years ago

moritzsalla commented 2 years ago

Bit of a webgl noob here, please excuse if the answer is obvious.

How would I go about creating multiple shader passes? I cannot find any documentation on this, other the native buffer access added in 0.1.1 (which to my understanding gives access to the previous pass).

Can this be achieved by creating multiple sandbox instances and passing them to each other as a texture similar to this?

const pass1 = new GlslCanvas(canvas);
const pass2 = new GlslCanvas(canvas);

const pass1 = sandbox.load(myFrag);
const pass2 = sandbox.load(myFrag2);

pass2.setUniform("u_texture”, pass1);