how can i use the right(left)buffer?

i am working on programing with opengl &
vc++.now i have a question about the using of stero buffer.that is
to say,i nees to display two images on the monitor alternatively on
the Asus v3800(with a stero glasses).
would you like to tell how i can do it in detail?
thank you very much!

Hi !

I have never done that but the OpenGL documentation says the following (this is a copy of the page on glDrawBuffer).


glDrawBuffer

The glDrawBuffer function specifies which color buffers are to be drawn into.

void glDrawBuffer(
GLenum mode
);

Parameters
mode
Specifies up to four color buffers to be drawn into with the following acceptable symbolic constants:
GL_NONE
No color buffers are written.
GL_FRONT_LEFT
Only the front-left color buffer is written.
GL_FRONT_RIGHT
Only the front-right color buffer is written.
GL_BACK_LEFT
Only the back-left color buffer is written.
GL_BACK_RIGHT
Only the back-right color buffer is written.
GL_FRONT
Only the front-left and front-right color buffers are written. If there is no front-right color buffer, only the front left-color buffer is written.
GL_BACK
Only the back-left and back-right color buffers are written. If there is no back-right color buffer, only the back-left color buffer is written.
GL_LEFT
Only the front-left and back-left color buffers are written. If there is no back-left color buffer, only the front-left color buffer is written.
GL_RIGHT
Only the front-right and back-right color buffers are written. If there is no back-right color buffer, only the front-right color buffer is written.
GL_FRONT_AND_BACK
All the front and back color buffers (front-left, front-right, back-left, back-right) are written. If there are no back color buffers, only the front-left and front-right color buffers are written. If there are no right color buffers, only the front-left and back-left color buffers are written. If there are no right or back color buffers, only the front-left color buffer is written.
GL_AUXi
Only the auxiliary color buffer i is written; i is between 0 and GL_AUX_BUFFERS –1. (GL_AUX_BUFFERS is not the upper limit; use glGet to query the number of available aux buffers.)
The default value is GL_FRONT for single-buffered contexts, and GL_BACK for double-buffered contexts.

Remarks
When colors are written to the frame buffer, they are written into the color buffers specified by glDrawBuffer.

If more than one color buffer is selected for drawing, then blending or logical operations are computed and applied independently for each color buffer and can produce different results in each buffer.

Monoscopic contexts include only left buffers, and stereoscopic contexts include both left and right buffers. Likewise, single-buffered contexts include only front buffers, and double-buffered contexts include both front and back buffers. The context is selected at OpenGL initialization.

It is always the case that GL_AUXi = GL_AUX0 + i.

The following functions retrieve information related to the glDrawBuffer function:

glGet with argument GL_DRAW_BUFFER

glGet with argument GL_AUX_BUFFERS

Error Codes
The following are the error codes generated and their conditions.

Error Code Condition
GL_INVALID_ENUM mode was not an accepted value.
GL_INVALID_OPERATION None of the buffers indicated by mode existed.
GL_INVALID_OPERATION glDrawBuffer was called between a call to glBegin and the corresponding call to glEnd.


Hope it helps !

Eric

thanks very much!
but I have try it several times.it does
not working.
this is part of my code.

PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number
PFD_DRAW_TO_WINDOW| // support window
PFD_SUPPORT_OPENGL| // support OpenGL
// PFD_DOUBLEBUFFER|
PFD_STEREO,
PFD_TYPE_RGBA, // RGBA type
24, // 24-bit color depth
0, 0, 0, 0, 0, 0, // color bits ignored
0, // no alpha buffer
0, // shift bit ignored
0, 0, 0, 0, // accum bits ignored
32, // 32-bit z-buffer
0, // no stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0 // layer masks ignored
};

void CTest1View::OnMyshow()
{
// TODO: Add your command handler code here
HWND hWnd=GetSafeHwnd();
HDC hDC=::GetDC(hWnd);
wglMakeCurrent(hDC,hglrc);
myinit();
mydisplay(image1,image2);

wglMakeCurrent(NULL,NULL);
SwapBuffers(hDC);

}




void CTest1View::mydisplay(unsigned char *image1,unsigned char *image2)
{

for(int i=0;i<20;i++)
{
glDrawBuffer(GL_LEFT);

// glColorMask(1.0,1.0,1.0,1.0);
// glRasterPos2i(0.0,10);
glDrawPixels(DrawWidth1,DrawHeight1,GL_RGB,GL_UNSIGNED_BYTE,image1);

glDrawBuffer(GL_RIGHT);

// glColorMask(1.0,1.0,1.0,1.0);
// glRasterPos2i(100.0,10);
glDrawPixels(DrawWidth1,DrawHeight1,GL_RGB,GL_UNSIGNED_BYTE,image2);
glFlush();

}
}

void CTest1View::OnTimer(UINT nIDEvent)
{
// mydisplay(image1,image2);

auxSwapBuffers();
CView::OnTimer(nIDEvent);

}

What is the differance between GL_RIGHT and GL_LEFT buffers and when do you use it. Is it when you have a dualhead grafic card with one buffer per output (left and right)???