How to (temporary) render in non stereo mode when stereo is activated ?

Hi,

I have made a stereo application with two different algorithms: toe-in and off-axis.

I can also cycle through Toe-in, Off-axis and
no stereo.
However in non stereo mode the app slows down
(it looks like the same view of the scene is rendered 2 times)…

Here is a bit of my code:

render() :

m_hudManager.update(elapsedMilliseconds);
m_scene3D.animate(elapsedMilliseconds);

ViewClipper::getInstance()->unapply();
s_3D->clearAllBuffers();
// s_3D is a just an abstraction layer
ViewClipper::getInstance()->apply();

// the following line is a bit complex but basically it is the same as if ‘(stereoActive)’
if (((SimpleSetting *) Settings::getInstance()->getSetting(Settings::STEREO))->getValue())
{
// LEFT EYE
s_Stereolizer.lookWithLeftEye();
// Render the scene
_renderScene();
// I had to add following line because left and right buffers are shared (Nvidia quadro, before we had a 3DLabs oxygen which worked fine without).
glClear(GL_DEPTH_BUFFER_BIT);
glClear(GL_STENCIL_BUFFER_BIT);

// RIGHT EYE
s_Stereolizer.lookWithRightEye();
// Render the scene
_renderScene();
}
else
{
s_3D->modelViewMode();
s_3D->loadIdentity();
s_3D->initBackBuffer();
getStudio().action(); // place the camera which is between LEFT_EYE and RIGHT_EYE positions
// render the scene
_renderScene();
}

s_WAbs->swapBuffers();
}

The clearAllBuffers is :

clearAllBuffers()
{
// We select back buffer so that nicely written opengl drivers should clear
// right and left buffer when in stereo mode at the same time.
glDrawBuffer(GL_BACK);

if (((SimpleSetting *) Settings::getInstance()->getSetting(Settings::SHADOWS))->getValue()
| | ((SimpleSetting *) Settings::getInstance()->getSetting(Settings::REFLECTIONS))->getValue()
| | ((SimpleSetting *) Settings::getInstance()->getSetting(Settings::HALOS))->getValue())
{
glClearStencil(0);
glStencilMask(0xff);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
else
{
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
}

initBackbuffer is :

initBackBuffer()
{
glDrawBuffer( GL_BACK );
}

I feel like it might be because of initBackBuffer ?! If stereo mode is enable maybe I should select either left or right back buffer and not GL_BACK ???

Anyone ?

Thanks.
Lekeno

Well, I tried to change the call (in initBackBuffer) to select the left back buffer, and then animation went smooth.
Unfortunelately, doing so is not enough because the right buffer is of course black, so animation is flickering :(scene/black/scene/black…).

If after drawing in the left back buffer, I draw in the right back buffer (without changing point of view), animation is smooth and there is no more flickering but as slow as in stereo (which is logic).

My very first try was to select the back buffer (GL_BACK) and draw once the scene, and call swap buffer but in that case animation is choppy…

What I would like is to be able to get a smooth animation and ALSO an increase in FPS.

Anyone? …please.

Lekeno