How to sum color buffer? (for stereographic view)


I wrote a programm, which renders the scene for the left eye and for the right eye. The scene for the left eye is rendered with a red lighting and for the right eye with a cyan lighting. So I can use red-cyan-glasses to get the steregraphic impression.
The problem is now, how to overlay the 2 images.

At first, i tried to render the 2 scenes alternatly. Since the time of the display()-loop is not synchronised to the VSynch-frequency, the picture flickers.

Actually, the problem is much easier. I just need to sum the color buffer of the left and the right scene (since left uses only red colors und right only cyan colors). But how to do that in short time? I tried to use the Accumulation-buffer which works, but is much to slow. Has anybody an idea how just to sum the 2 buffers or write data in the framebuffer successively whithout deleting the privious data?

btw: I use GLUT, which offers the GLUT_STEREO option which is not working on my 2 machines. So thats no option for me.

ThX, keV

In fact this is very simple using color masks :

enable vsync.

clear color and depth buffer
You set color mask to only let RED to pass.
Draw left eye.
clear depth buffer ONLY
You set color mask to only let BLUE and GREEN to pass.
Draw right eye.

This page is interesting, but mostly wrong, be sure to go straight to the end, to read both “Feedback from” parts :

Many thanks ZbuffeR, that was exactly I was looking for.
BTW, it is important to set the color mask back to glColorMask(true,true,true,true) before calling glClear(GL_COLOR_BUFFER_BIT) to ensure every color is cleared.