Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
mari0trujill0
mari0trujill0's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Ellipse mask with background video
[1 Reply]
04-May-2013 11:06 PM
Forum:
Programming Questions
Hi, I'm new in processing
I want to make a mouse controlled mask with a ellipse shape, and video in the background.
But I only could made it with a static image, like in the code below
Thanks for your help
PShader maskShader;
PImage srcImage;
PGraphics maskImage;
void setup() {
size(800, 600, P2D);
srcImage = loadImage("imagen.jpg");
maskImage = createGraphics(srcImage.width, srcImage.height, P2D);
maskImage.noSmooth();
maskShader = loadShader("mask.glsl");
maskShader.set("mask", maskImage);
background(0);
noCursor();
}
void draw() {
maskImage.beginDraw();
maskImage.background(0);
if (mouseX != 0 && mouseY != 0) {
maskImage.noStroke();
maskImage.fill(255, 0, 0);
float speed = abs(mouseX-pmouseX) + abs(mouseY-pmouseY);
maskImage.ellipse(mouseX, mouseY, 30+speed, 30+speed);
}
int m = millis();
maskImage.endDraw();
if (mousePressed == false) {
maskImage.background(0);
}
shader(maskShader);
image(srcImage, 0, 0, width, height);
}
«Prev
Next »
Moderate user : mari0trujill0
Forum