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 › PeasyCam manipulating 2 cams + OpenGL anaglyph
Page Index Toggle Pages: 1
PeasyCam manipulating 2 cams + OpenGL anaglyph (Read 1182 times)
PeasyCam manipulating 2 cams + OpenGL anaglyph
May 15th, 2009, 11:14am
 
Hey there!!! I'm trying to do some 3d realtime visuals with anaglyphs and was wondering if it could be possible to implement 2 cameras feed them some OpenGL scene using PeasyCam and implement some camera movement so that both cameras move the exact same way and the anaglyph can be displayed properly.

Another solution would be the typical implementation of an anaglyph in OpenGL that uses this structure:

Code:
//setup camera for left eye
GL gl=((PgraphicsOpenGL)g).beginGL();
gl.glColorMask(true,false,false,true);
//draw scene
((PgraphicsOpenGL)g).endGL();
//setup camera for right eye
gl=((PgraphicsOpenGL)g).beginGL();
gl.glColorMask(false,true,true,true);
//draw scene
((PgraphicsOpenGL)g).endGL();


but I don´t know how to move precisely PeasyCam to get the desired effect, I insist in using PeasyCam because of its extremeyl easy way of implementing it. Anyways any help would be really appreciated.

Another thing!!! Is there any work done similar to what I want to do? there seems to be really little info on anaglyphs in processing and even in OpenGL Oh well... thanks for the help!
Re: PeasyCam manipulating 2 cams + OpenGL anaglyph
Reply #1 - May 15th, 2009, 7:50pm
 
I'm also very interested in setting up some stereo-viewing with PeasyCam.
Re: PeasyCam manipulating 2 cams + OpenGL anaglyph
Reply #2 - May 21st, 2009, 11:05am
 
I tried this out with PeasyCam... sort of works.. but I don't know much about stereo viewing.  So to me it just looks like two images of the same thing.  Don't understand how to make it pop out in 3d.

Code:

/**

stereo viewing taken from http://processinghacks.com/hacks:stereo_viewing

@author John Gilbertson

*/
import processing.opengl.*;
import peasy.*;  //camera control
import javax.media.opengl.*;

GL gl;
PeasyCam cam;

void setup()

{

 size(500,300,OPENGL);
 gl=((PGraphicsOpenGL)g).gl; //We need this to set some OPENGL options.
 perspective(PI/3.0,1,0.1,1000); //this is needed ot stop the images being squashed.
 noStroke();

cam = new PeasyCam(this, 75);
cam.setMinimumDistance(width/14);
}



void draw()

{
 ambientLight(64,64,64); //some lights to aid the effect.
 pointLight(128,128,128,0,20,-50);
 background(0);
 fill(255);

 // Left Eye

 gl.glViewport(50,50,200,200); // This means anythign we draw will be limited to the left half of the screen.

 pushMatrix();
 box(30);
 translate(0,0,30);
 box(10);
 popMatrix();

 // Right Eye

 gl.glViewport(250,50,200,200);
 
 pushMatrix();
 box(30);
 translate(0,0,30);
 box(10);
 popMatrix();

}
Page Index Toggle Pages: 1