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 › mapping video on 3D mesh
Page Index Toggle Pages: 1
mapping video on 3D mesh (Read 990 times)
mapping video on 3D mesh
May 15th, 2006, 4:38pm
 
Hi,

I'm trying to map video on 3D mesh.
With P3D the video texture mapping work, but with OPENGL the mesh is mapped with black. Is there something that should be change to make it work with OPENGL ?

The code is from a previous post by mark_h - http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Contribution_3DOpenGL;action=display;num=1136327599)

I can not post the code, it's too long.
So the code is the same as the one posted by mark_h, I just changed:

size(1024,768, P3D);
for
size(1024,768, OPENGL);

added

Capture cam;
PImage texmap;

void captureEvent(Capture cam)
{
 cam.read();
 texmap.copy(cam, 0, 0, cam.width, cam.height, 0, 0, texmap.width, texmap.height);
}


thanks,
Re: mapping video on 3D mesh
Reply #1 - May 15th, 2006, 8:09pm
 
I was able to get it to work.  Lets see...

For one, if you make the cam the same size as the texmap, you can use arraycopy to get a faster duplicate.  So the code would be:

Code:

if (cam.available()){
cam.read();
arraycopy(cam.pixels, texmap.pixels);
texmap.updatePixels();
}


I guess there is no 'for two'.  Give it a shot and see if that helps.

-robert
Re: mapping video on 3D mesh
Reply #2 - May 15th, 2006, 8:42pm
 
it works !!!

so I was missing the texmap.updatePixels();
and thanks for the advice about arraycopy.

btw, I have mini DV tape to watch, my friend recorded your talk at FITC when I was next door attending to Occulart's talk.

//hugues
Page Index Toggle Pages: 1