i'm trying to display about 200 instances of one video, as described
here.
Using JMC to draw the video texture in OpenGL works fine, frameRate is a-okay.
i'm looping through all tiles and setting the position in the video accordingly, however it is displaying the same video frame for all tiles in the loop, even if it should offset the playback position by some amount for each tile, i.e. it should look like this:
but does look like this:
Code:import processing.opengl.*;
import peasy.*;
import javax.media.opengl.*;
import java.util.*;
import jmcvideo.*;
PGraphicsOpenGL pgl;
GL gl;
PeasyCam cam;
JMCMovieGL3D scan;
float count = 0;
void setup()
{
size(800, 600, OPENGL);
cam = new PeasyCam(this, 1000);
cam.setRotations(.8, 0, 0);
cam.setMinimumDistance(50);
cam.setMaximumDistance(4000);
scan = new JMCMovieGL3D(this, "scan1.mov", RGB);
}
void draw()
{
background(0);
doGLStuff();
count+=0.00005;
}
void drawSlices(int num)
{
float perc = 0;
for(int i = 0; i < num; i++)
{
perc+= 1.0/num;
perc = (perc+count)%1;
pushMatrix();
scan.setPlaybackPercentage(perc);
scan.image(gl, -scan.width/2, -scan.height/2, -(num/2*27)+i*27, scan.width, scan.height*1.4);
popMatrix();
}
}
void doGLStuff()
{
pgl = (PGraphicsOpenGL) g;
gl = pgl.beginGL();
gl.glDisable(GL.GL_DEPTH_TEST);
gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);
drawSlices(200);
pgl.endGL();
}
it seems that setPlaybackPercentage() does not update during the loop?
does the setPlaybackPercentage() method not update quick enough, or only at the end of draw() or something? i've had a look at the JMC source, but couldn't do anything helpful to it...
is there a better way to access the pixels of the video directly …?