Problem with Video blending using GSVideo
in
Contributed Library Questions
•
10 months ago
Hello,
I'm a very beginner and would like to get your help for the problem of video blending.
I'm currently trying to blend two movies using the examples of GSVideo and GLGraphics libraries.
However, nothing happens when I run the sketch.
Here is the code.
import processing.opengl.*;
import codeanticode.glgraphics.*;
import codeanticode.gsvideo.*;
GSMovie movieA;
GSMovie movieB;
GLTexture bottomLayer, topLayer, resultLayer;
LayerBlend current;
void setup()
{
size(640,480, GLConstants.GLGRAPHICS);
background(255);
current = new LayerBlend(this, "Darken", "BlendDarken.xml");
movieA = new GSMovie(this, "arm.mov");
bottomLayer = new GLTexture(this);
movieA.setPixelDest(bottomLayer);
movieA.loop();
movieB = new GSMovie(this, "Digidelic.mov");
topLayer = new GLTexture(this);
movieB.setPixelDest(topLayer);
movieB.loop();
resultLayer = new GLTexture(this, topLayer.width,topLayer.height);
}
void movieEvent(GSMovie movie) {
movie.read();
}
void draw()
{
if((bottomLayer.putPixelsIntoTexture()) && (topLayer.putPixelsIntoTexture())) {
current.apply();
resultLayer.render(0,0);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////
class LayerBlend {
String name;
GLTextureFilter filter;
LayerBlend(PApplet Parent,String Name,String XmlFile) {
name = Name;
filter = new GLTextureFilter(Parent,XmlFile);
}
void apply() {
filter.apply(new GLTexture[]{bottomLayer, topLayer}, resultLayer);
}
}
Any advice and help would be appreciated.
Thank you for your time.
2