How can i apply several shader for one rectangle?
in
Programming Questions
•
9 months ago
Hello. Please tell me how can i apply several shader for one rectangle? I trying to do this so.
- .......
- boolean mySwitch;
- ......
- void setup()
- {
- size(800,600,P2D);
- img = loadImage("background.jpg");
- for(int i=0;i<12;i++)
- {
- gliff[i] = new Gliff();
- }
- shine = loadShader("shine.glsl");
- shine1 = loadShader("shine1.glsl");
- shader(shine1);
- shader(shine);
- shine1.set("posLight",float(width/2),float(height/2));
- shine.set("posLight",float(width/2)+20,float(height/2));
- }
- void draw()
- {
- rect(0,0,width,height);
- if (mySwitch)
- {
- rect(0,0,width,height);
- shine1.set("posLight",currX,float(currY));
- currX=currX + time;
- currY=currY + time*k;
- mySwitch = false;
- print("2 ");
- }
- else
- {
- rect(0,0,width,height);
- shine.set("posLight",currX,float(currY));
- currX=currX + time;
- currY=currY + time*k;
- mySwitch = true;
- print("1 ");
- }
- }
1