using pShape for GLMovie playback stutters 2nd movie

Hi, I need help with movie playback on Raspberry pi. I need to do video mapping, hence using pShape for transforming video. Everything works good(thanks gohai for all the amazing work!), trouble begins when I have more than 1 video in my sketch. As soon as I apply a transform, the video starts to stutter. Its almost like the frames get intertwined. I was able to replicate the problem with a simple rotateX. Press "m" to change the movie and "x" to begin rotating Soon the, second movie only, begins to stutter. Can someone help me ?

Cheers, Des

Here is the problematic sketch :

import gohai.glvideo.GLMovie; import gohai.glvideo.PerspectiveTransform; import gohai.glvideo.WarpPerspective; import java.awt.geom.Point2D;

GLMovie movie,movie2,source;

PShape sh;

float xRot=0;

void setup() {

movie = new GLMovie(this, "/home/pi/sketchbook/libraries/glvideo/examples/SingleVideo/data/launch1.mp4"); movie.loop(); movie2 = new GLMovie(this, "/home/pi/sketchbook/libraries/glvideo/examples/SingleVideo/data/launch1.mp4"); movie2.loop(); source=movie; frameRate(15); size(640, 480,P3D);

}

void draw() {

if (movie.available()) { movie.read(); } if (movie2.available()) { movie2.read(); }

background(0);

createLayer(); sh.rotateX(xRot); shape(sh);

}

void keyPressed() { if(key=='m') { if(source==movie) source = movie2; else source = movie;
}

if(key=='x') {

xRot+=.1;   

}

}

void createLayer() {

sh= createShape();

sh.beginShape();

sh.texture(source);

sh.vertex(0, 0, 0, 0); sh.vertex(source.width, 0, source.width, 0); sh.vertex(source.width, source.height, source.width,source.height); sh.vertex(0, source.height, 0, source.height);

sh.endShape();

}

Tagged:

Answers

  • @codeanticode Is all of this happening on GPU?

  • Good question, and also a question I cannot answer. How can I make sure ? Thanks.

  • I don't know either. Andres would know.

  • I did try Sardtok's shader mapping sketch and the same behavior happens. So I'm not sure this is a performance issue. Any other ideas ? Thanks !

  • Answer ✓

    In case it might be useful for someone, I figured out a workaround :

    You have to play 'all' the movies (textured in your pShapes) in the first draw call. After that first call, you can then freely switch between movies and apply pShape deformations without hiccups.

    I'm still interested in finding out why this happens, any takers ?

Sign In or Register to comment.