PDA

View Full Version : Quad-Buffered stereo --> using only 2 buffers



PhilY
07-11-2002, 11:42 AM
I know the stereo issue has been discussed a lot but this is a little twist on that.

Now, I have a program that I want it to be able to switch between stereo and non-stereo mode in real (or almost real) time.

When the stereo mode is off, when I select GL_BACK for drawing buffer, it draws to the GL_BACK_LEFT and GL_BACK_RIGHT buffers, which slows down the rendering significantly.

So now I'm thinking, I'll just use the GL_BACK_LEFT and GL_FRONT_LEFT for rendering so I just specify the drawing buffer to GL_BACK_LEFT. The problem is GL still insists on using all 4 buffers when swapping buffers, doing the stereo swap with the left and right buffers; the right buffer is cleared to black so I just see half-dim image of what should be rendered, flickering.

So my question is: Is it possible to only use two buffers when I'm in quad-buffered mode? I guess that kinda defeats the purpose somewhat but I wanna do stereo and non-stereo as I mentioned.

Only way I could think of to achieve my goal is to save all the information --> destroy the RC --> then create a new RC with stereo enabled or disabled. But I don't wanna do that http://www.opengl.org/discussion_boards/ubb/frown.gif Maybe I'm missing something really obvious... wglSetSwapBuffers(GL_BACK_LEFT, GL_FRONT_LEFT) or something like that? I know there actually is a function called: wglSwapLayerBuffers() but I don't think that works... or does it?

Any help is greatly appreciated.

- Phil

PhilY
07-11-2002, 11:51 AM
Oh, I'm using Oxygen GVX1, BTW.

Adrian
07-12-2002, 02:09 AM
I don't think there is an easy way to do that.

When I wanted to mix stereo and non stereo on the screen I always drew to both GL_BACK_LEFT and GL_BACK_RIGHT rather than GL_BACK because it was for some strange reason much quicker that way. That was on a GF3 DCC.

You could try drawing to the back left buffer, capturing the image using glCopyTexSubImage2D and then render it as a quad to back right? This should be much quicker then drawing the scene geometry twice.

[This message has been edited by Adrian (edited 07-12-2002).]

Overmind
07-14-2002, 04:32 AM
What does "save all the information" mean for your application? If it's only saving the display lists and texture objects, you can preserve them by using shared lists and multiple contexts.

In most applications all the state information of OpenGL is stored somewhere in application memory anyways and they don't rely on the state preserved across frames, so it should not be a problem to destroy the context between two frames.

Of course that's going to be slow, but I guess you don't want to switch stereo on/off every frame, so that shouldn't be a problem.

Overmind

PhilY
07-15-2002, 06:16 AM
Thanks for your replies.

One thing I just found out is that I have to destroy the current window and create a new one in order to change the pixel format - and GL_STEREO is part of pixel format.

Now, my program uses lots and lots of textures. So if I created another window, DC, and RC --> shared the display lists and textures --> then destroy the original RC, DC, and window, will the textures and display lists still available to the new RC even tho the original RC is now destroyed?

I guess I could keep both of the windows and make one or the other invisible but I can't really afford to waste memory; plus the stereo mode change is gonna be very infrequent.

Adrian, your idea sounds interesting and doable. Maybe I will try that out if this whole window business turns out too messy.

- Phil

PhilY
07-15-2002, 06:26 AM
I also need to update the textures from time to time. Now I read that you can only modify the textures only from the RC that originally created the textures.

Is that true? I suppose there really isn't a way around it...