# The Industry's Foundation for High Performance Graphics

1. ## Stereo Anaglyph using glColorMask

Wondering if someone could verify that my cam panning is correct for the proper color or if I'm doing this completely wrong. Thanks

for(int x3d = 0; x3d < 2; x3d++) {

//3d View - Set up Color Masking
if (anaglyph) {
if(x3d == 0) {
cam.pan(2,0);
gl.glColorMask(true, false, false, true);
}
else {
cam.pan(-2,0);
gl.glColorMask(false, true, true, true);
}
}
else {
x3d++;
}
Draw a bunch of stuff...
}

2. ## Re: Stereo Anaglyph using glColorMask

When you set the two cameras for anaglyph rendering you should set the two eye position to an appropriate distance from each other. This fully depends on your application.
Besides that, you also want to use a different view direction for the two eyes based on where is the focus distance for the "eyes".
Actually the simplest way to do it is to use gluLookAt.
E.g.:

gluLookAt(-1,0,0, 0,0,-3, 0,1,0);
... draw left eye image ...
gluLookAt( 1,0,0, 0,0,-3, 0,1,0);
... draw right eye image ...

Of course you don't have to use gluLookAt but whatever view matrix you like but the math behind it should be something similar.
So set the eye positions but don't forget to set their direction as well so the view directions intersect at the focus plane.

3. ## Re: Stereo Anaglyph using glColorMask

Might I be able to change the eye position using glTranslate?

4. ## Re: Stereo Anaglyph using glColorMask

Read "Asymmetric frustum parallel axis projection stereo" section here, at the bottom :
http://www.orthostereo.com/geometryopengl.html

The drawing is better here, read "Off-axis (Correct)" :
http://local.wasp.uwa.edu.au/~pbourk.../stereorender/

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•