Mask Shader with Processing 2.0
in
Programming Questions
•
8 months ago
Hello,
I am trying to implement alpha mask shader with PShader and keep getting an "shader() called with a wrong shader" error.
Here's the code.
- PShader mask;
- PImage imgTex;
- PImage maskTex;
- PImage destTex;
- void setup()
- {
- size(displayWidth, displayHeight, P3D);
- setupGL();
- }
- void draw()
- {
- drawGL();
- }
- void setupGL() {
- imgTex = loadImage("bg.png");
- maskTex = loadImage("mask.png");
- mask = new PShader(this, "shaders/SimpleVS.glsl", "shaders/Mask.glsl");
- }
- void drawGL() {
- imageMode(CORNER);
- mask.set("mask_factor", 0.0);
- mask.set("src_tex_unit0", imgTex);
- mask.set("src_tex_unit1", maskTex);
- shader(mask);
- image(imgTex, 0, 0, width, height);
- resetShader();
- }
Can you please help?
You can find the whole sketch with shaders and data
here.
1