taking the library example code:
import processing.opengl.*;
import javax.media.opengl.*;
import stereo.*;
Stereo stereo = null;
Quad[] quads;
void setup()
{
size(640, 480, "stereo.ActiveStereoView");
frame.setResizable(true);
quads = new Quad[20];
for(int i = 0; i<20; i++) {
quads[i] = new Quad(.01, i);
}
background(0);
float eyeSep = (float) (999.999 / 30f); //?????
eyeSep = .1f;
frameRate(60);
// set last parameter according to type of stereo
// ACTIVE, PASSIVE, ANAGLYPH_REDLEFT_CYANRIGHT, ANAGLYPH_CYANLEFT_REDRIGHT etc.
stereo = new Stereo(this, eyeSep, 45f, .1f, 1000f, Stereo.StereoType.ACTIVE);
}
//these are test variables....
float cx = 0f; float cy = 0f; float cz = 10f;
void draw()
{
background(0,0,0,255);
ActiveStereoView pgl = (ActiveStereoView) g;
GL gl = pgl.beginGL();
{
// only needs to be called repeatedly if you are
// changing camera position
stereo.start(gl,
cx, cy, cz,
0f, 0f, -1f,
0f, 1f, 0f);
stereo.right(gl); // right eye rendering
render(gl);
stereo.left(gl); // left eye rendering
render(gl);
// only needed for anaglyph
stereo.end(gl);
}
pgl.endGL();
}
void render(GL gl)
{
gl.glColor4f(1f,0f,1f,1f);
gl.glTranslatef(0f,0f,-10f);
for(int i = 0; i<20; i++) {
quads[i].display(gl);
}
}
public void keyPressed()
{
if (key == 'a')
{
cz += .1f;
}
if (key == 'z')
{
cz -= .1f;
}
if(keyCode == LEFT) stereo.eyeSeperation -= .01;
if(keyCode == RIGHT) stereo.eyeSeperation += .01;
}
works good. I'm repeating i'm very new to processing but as far as i understand, the function stereo is called to time to rendere the scene on both the two side. Inside the Quads class there are some direct OpenGl calls on the GL object.
If i try to render a bos(100) for example before the right render and before the left render, the final image is not stereo.
Also i'm intersted importing all the simple example shown in the 3d tutorials. For example I'v imported the rotating toroids, and another time rendering it before thew stereo left rendering and before the right but i can see two images translated and not in stereo.
What am I doing wrong?
Thanks