Draw video capture over movie background (need some help)
in
Contributed Library Questions
•
1 year ago
Hi there!
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I'm trying to draw a video capture over a video background but i can't play both at the same time... i'm a kind of new to programing so forgive me for these newbe questions..
here's the code i've got so far:
import codeanticode.gsvideo.*;
GSMovie movie;
GSCapture video;
void setup() {
size(640, 480);
//start video capture
video = new GSCapture(this, 320, 240);
video.start();
loadPixels();
// Load and play the video in a loop
movie = new GSMovie(this, "station.mov");
movie.loop();
}
void movieEvent(GSMovie movie) {
movie.read();
}
void draw() {
//draw movie
image(movie, 0, 0, width, height);
//draw video capture
if (video.available()) {
video.read();
video.loadPixels();
for (int x=0;x<320;x++) {
for (int y=0;y<240;y++) {
int image_pos=(y*width)+x;
int video_pos=(video.width - x - 1) + y*video.width;
pixels[image_pos] = video.pixels[video_pos];
}
}
}
updatePixels();
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if someone could help me or tell me what i'm doing wrong i'll be very grateful, i'm stuck with these for days..
Cheers..
João
1