Mixing shaders?

Is it possible to mix multiple shaders in one mesh? I got a black/white map I generate each frame and draw it using a alpha filter, but is it possible to add an blir filter to it after the alpha?

@Multinfs - if you draw the image to memory first (with setContext), you can use it as the texture for a second image with a second shader. There is a performance hit, though.

As @Ignatz says, unless you write your own handling of compositing of shaders.

blackwhite = [[ vec4 blackwhite(vec4 input) { ... } ]]
alpha = [[ vec4 alpha(vec4 input) { ... } ]]
blur = [[ vec4 blur(vec4 input) { ... } ]]

s = shader([[ vertexshader ]], blackwhite .. alpha .. blur .. [[

void main() {
    gl_FragColor = blur(alpha(blackwhite(vColor)));


@Ignatz That seems to remove the alpha effect from the first shader, I’m not sure this is thr right way though.

Setcontext image1,
Draw black background,
Fill to white,
Draw the shape with the first shader,
Setcontext to screen,
Draw image1 with the second shader,

@Multinfs - why would it remove the alpha effect?

Your sequence seems OK to me.