blue&red 3D glasses

I’m trying to make 3d scene using blue&red glasses. The plan is… render scene from left camera using only red lights (not seen on screen), then render from right camera using only pure blue lights(not seen too), and then add both rendered scenes and display buffer… How to add it on line. I’m using microsoft system

thanks a lot

Mateusz

You can render the entire scene in greyscale, and use color masks to mask out the red and green colors.

glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE);
SetupSceneForRedEye();
DrawSceneForRedEye();
glColorMask(GL_FALSE, GL_FALSE, GL_TRUE, GL_TRUE);
SetupSceneForBlueEye();
DrawSceneForBlueEye();

glColorMask controls which channels are drawn and which are not.

I’ve heard there’s an example of such 3D processing with glut 3.7 at opengl.org

it’s called bluered or redblue, but I haven’t been able to find it on my directory.

Basically, its uses the colormasks and uses the projection matrix

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glTranslatef(0.1, 0.0, 0.0);
RenderRed();
glTranslatef(-0.1, 0.0, 0.0);
RenderBlue();
glPopMatrix();

V-man

thanks, I try with glColorMask(…) but there is something strange. It works much slower, even I render only one “eye” scene??? and sometimes some part of surface is not rendered (I clear depth buffer between “eyes”. Do I something wrong??

   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// RENDER LEFT EYE
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glColorMask( GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE );

gluLookAt( ..... );

... RENDER SURFACE ...

// RENDER RIGHT EYE
glLoadIdentity();
glClear(GL_DEPTH_BUFFER_BIT);	
glColorMask( GL_FALSE, GL_TRUE, GL_FALSE, GL_TRUE );

gluLookAt( ..... );

glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );

... RENDER SURFACE ...

glFlush();

thanks

Your algorithm is correct.

Though, I don’t think you’ve made something to render a greyscale scene !

If you don’t render a greyscale scene, then the red buffer will only keep trace of the red data.
For instance, if you have a pure red cube, a pure green sphere, a pure blue cone and a pure white cylinder, then
glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE) will only render the cube and the cylinder, and glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE) will only render the sphere and the cylinder.

You have to switch to greyscale or black&white rendering before you use the glColorMask technique.

You seem to have an extra glcolormask just before rendering the second ‘surface’ - I think that should be after rendering the second surface to return the colour mask to default.
Also, the colormask approach will not work properly if your red/blue lenses don’t match true red and blue exactly - I haven’t found a pair of red/blue glasses that use the true colours - for instance, the blue lense tends to let some of the red colour through - this causes lots of ghosting, and can ruin the stereo effect.

I’m sorry, it’s my mistake, fortunately only in this pseudocode!
Yes! I know that stereo quality depence on glasses. I’ve try with red&green too, with good results. Ghosting is little bit more… That depence on monitor too.
I think that much better effects can be reached with multiplaxing eyes LDC glasses or real VR glasses, but r&b or r&g are the cheapest, the coolest, and most practical, particulary in the summer

You tried chromadepth glasses?
They’re probably as cheap as red/blue glasses.
Basically, anything red is in the foreground, anything green is in the midground, anything blue is in the background. They’re fun, because any screensaver looks cool with them, by default!