PDA

View Full Version : Question about glClear()



CoGiTo
03-08-2006, 05:12 AM
glDrawBuffer(GL_BACK_LEFT);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
Draw();

glDrawBuffer(GL_BACK_RIGHT);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
Draw();

In my opinion the every glClear() delete left and right buffer together. What must i do to cancel only one buffer?

Thanks.

Relic
03-08-2006, 06:02 AM
What you posted is the perfect clear and render sequence for stereo rendering on a stereo pixelformat.
Keep it this way if you're working in stereo!

GL_BACK means both left and right back color buffers in double buffered stereo.
GL_FRONT_AND_BACK means all four color buffers then.

BUT!!! There is only one depth buffer in spec conformant stereo implementations.

If you don't have a stereo pixelformat, GL_BACK_RIGHT should throw an error and GL_BACK_LEFT == GL_BACK in monoscopic formats will remain the target.

CoGiTo
03-10-2006, 09:32 AM
sure, i have set up PFD_STEREO in pixel format....