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 › "Redraw" shape from different camera in same frame
Page Index Toggle Pages: 1
"Redraw" shape from different camera in same frame (Read 1089 times)
"Redraw" shape from different camera in same frame
Sep 15th, 2009, 9:57am
 
i have a little problem concerning the draw() and camera() methods..

in my draw() i create a relatively complicated shape, and want to render it into the same frame from 2 different cameras (its going to be one in red and one in cyan, for 3d-glasses).

i'd like to keep the shape i created and not recalculate it from another perspective.. instead i'd like to shift the camera, rerender the shape from that point and add it to the frame i already rendered from the first camera?

How do i keep the image created so far when swtiching cameras?
How do i add the two into one image?

Hope you can help.. alex
Re: "Redraw" shape from different camera in same frame
Reply #1 - Sep 15th, 2009, 1:35pm
 
do you know there already exist a 3d red/cyan library ?
http://leebyron.com/else/redblue/
Re: "Redraw" shape from different camera in same frame
Reply #2 - Sep 16th, 2009, 2:57am
 
thanks, i'll look into that code!

just for learning, i managed to save a copy of the graphics, and blend it into the newer one. but i can't seem to get the tint right, it only ever affects the this.g.

How can i call tint on left (in the code below)? A cast to PGraphics doesn't do the job.

Code:

tint(255,0,0,100);
left = this.g.get();

camera((float)width/2.f+5, (float)height/2.f, (float)(height/2.0) / tan((float)(PI*60.0 / 360.0)), (float)width/2.f, (float)height/2.f, 0, 0, 1, 0);
tint(0,255,255,100);
left.blend(this.get(),0,0,width,height,0,0,width,height,ADD);
image(left,0,0);
Re: "Redraw" shape from different camera in same frame
Reply #3 - Sep 16th, 2009, 5:41pm
 
ive made a test with stereoscopic for opengl+shaders. if you're into stereo, look into:

http://www.pixelnerve.com/v/2009/09/07/hmm-3d-stereoscopic-view/

have fun.
Page Index Toggle Pages: 1