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 & HelpSyntax Questions › multiple cameras
Page Index Toggle Pages: 1
multiple cameras (Read 386 times)
multiple cameras
Jun 23rd, 2008, 11:17pm
 
Hello Everyone,

I wanted to get some guidance on getting a Processing application (I'm working in Eclipse using OpenGl) that has 2 cameras; 1. shows the entire scene 2. is 'looking' at a subset of this scene.

I'm thinking that I probably need a JFrame w/ 2 windows, one for each of the 2 cameras, but am not sure how to implement this yet.

Thanks!
--MA
Re: multiple cameras
Reply #1 - Jun 23rd, 2008, 11:33pm
 
You can do this with a little bit of messing around in pure GL mode with:

Code:
import javax.media.opengl.*;

//....
GL gl=((PGraphicsOpenGL)g).beginGL();
gl.glViewport(0,0,width/2,height);
((PGraphicsOpenGL)g).endGL();
perspective(PI/3.0,(width/2.0)/height,0.001,1000);
//this will only draw in the left half of the screen...
//draw stuff...
GL gl=((PGraphicsOpenGL)g).beginGL();
gl.glViewport(width/2,0,width/2,height);
((PGraphicsOpenGL)g).endGL();
//this will only draw in the right half.
//draw stuff again.

//...
Page Index Toggle Pages: 1