We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › translating a gl texture containing a jmcvideo..
Page Index Toggle Pages: 1
translating a gl texture containing a jmcvideo..? (Read 838 times)
translating a gl texture containing a jmcvideo..?
Feb 4th, 2010, 5:42am
 
hi,

i'm doing a 3D reconstruction of this video. It's working fine using a series of still images:

...

simply aligning them in 3D. it doesn't seem to work as applet, so here's the app if you want to try.

what i'd like to do now, is replace the still images with video textures which are offset by some amount of frames to each other, so that the whole thing is moving.

i don't even know yet if the computer will be able to play that much video simultaneously, but i'm having a more basic problem here:

i'm using the JMCvideo library to load the video into openGL, and the 3D translation of the video does not do what it should, in fact it does nothing.

Code:
import processing.opengl.*;
import peasy.*;
import javax.media.opengl.*;
import java.util.*;
import jmcvideo.*;

PGraphicsOpenGL pgl;
GL gl;

PeasyCam cam;

JMCMovieGL scan;
PFont font;

void setup()
{
size(800, 600, OPENGL);
font = createFont("Sans Serif", 20);
textFont(font);
cam = new PeasyCam(this, 1000);
cam.setRotations(.8, 0, 0);
cam.setMinimumDistance(50);
cam.setMaximumDistance(1200);

scan = new JMCMovieGL(this, "scan1.mov", RGB);
scan.loop();
}

void draw()
{
imageMode(CENTER);
background(100);

doGLStuff();

}

void drawSlices(int num)
{
for(int i = 0; i < num; i++)
{
pushMatrix();
translate(-scan.width/2, -scan.height/2, -i*100);
scan.image(gl, 0, 0, scan.width, scan.height);
text(nf(frameRate, 2, 1)+" fps", 20, height-20);
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(10);
println("drawing frame " + frameCount);
pgl.endGL();
}


so the JMCVideoGL class has  an image function, and i figured you could use it the same way as you would a PImage, however it doesn't translate like it should.

Instead it just draws the video 10 times at the same coordinates. On top of that, if you rotate the camera, the text(frameRate..) stuff seems to rotate in an entirely different perspective than the video textures.  Cheesy  Undecided

So i reckon i have to kind of wrap the video texture into the same gl context as the peasycam stuff… or something….?
Re: translating a gl texture containing a jmcvideo..?
Reply #1 - Feb 4th, 2010, 8:22am
 
solved by extending JMCVideoGL to support positioning the texture in 3D space.
Page Index Toggle Pages: 1