why only one side of image show on the screen?

As shown follows, first I call the function to show the image for the left eye, second I call the function to show the image for the right eye, but only the left show on the screen. If I delete the call of left side eye, the right side one can show on the screen.
Thanks,

void myglDrawStereoDisplay()
{
// clear drawing buffers and z-buffer(s)
glMatrixMode (GL_PROJECTION);
glFlush();
glLoadIdentity();
glDrawBuffer (GL_BACK);
glClearColor(0.0f, 0.0f,0.0f,0.0f);
// non-black bkgr, less ghosting
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// Draw the left eye view

glFlush();
glDrawBuffer (GL_BACK_LEFT);
glPushMatrix();
myglLeftEyeProjection(-20, 20, -20, 20, m_nearBorder, m_farBorder,
m_Eye2Screen, 3.1);
DrawGLScene();
glPopMatrix();
glClear (GL_DEPTH_BUFFER_BIT);

// Draw the right eye view

glFlush();
glDrawBuffer (GL_BACK_RIGHT);
glPushMatrix();
myglRightEyeProjection(-20, 20, -20, 20, m_nearBorder, m_farBorder,

m_Eye2Screen, 3.1);
DrawGLScene();
glPopMatrix();
glFlush();
}

You can find some working quad buffering stereo code here, it should help you debug the problem. http://astronomy.swin.edu.au/~pbourke/opengl/stereogl/

You have a card that supports quad buffering right?

Thanks for your reply, I am testing it.
Yes, my graphic card is 3Dlab wildcat 6110.
I intend to use a 3D Glass to implent the stereo mode application.

You should call glDrawBuffer, then clear the buffer with glClear before rendering.

Notice that you never clear the back buffer for the right buffer.

No, he does. The first glDrawBuffer(GL_BACK) selects both left and right back buffer.

Though I also would split the clear in to two identical call like

glDrawBuffer(GL_BACK_LEFT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
…drawing
glDrawBuffer(GL_BACK_RIGHT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
…drawing

This saves one glDrawBuffer call and might run better on some implementations.

(edit And remove the glFlush calls. You render double buffered and the swap will care for the rendering to have finished.

[This message has been edited by Relic (edited 01-08-2003).]

Thanks all for your quick reply, I made a low level errors in the function of Drawglscene(), I left one more glLoadIdentity() in that call, after delete it, it’s ok now. Thanks again.