Sign in to follow this  
Dave Blake

OpenGL Multiple rendering contexts and the back buffer

Recommended Posts

I am looking at reworking a 2D graphics GDI based MDI style Windows app to use OpenGL for faster and more exotic displays - an interesting challenge! I think I have figured out how to handle the multiple rendering contexts necessary for MDI, activating the context only to render and then deactivating. But I am wondering how expensive the wglMakeCurrent calls will be on speed, especially when one of the child windows is in animation mode. Any tips for MDI with OGL? With GDI I draw my graphic on an internal bitmap buffer and then blt it to the window, so if the window subsequently repaints it does not require a redraw. Pretty standard GDI double buffering stuff. In comparison, in OpenGL it seems that I will have to re-render with every window repaint. This makes sense if the app is a single window with a rapidly changing scene, but wasteful for my multi-window not always animated situation. I am wondering in OpenGL if when using PFD_DOUBLEBUFFER can I treat the back buffer in a similar way to the GDI bitmap buffer? Is the content of the back buffer maintained after a swapbuffers call? It seems to be in simple tests. Is the content of the back buffer maintained when switching rendering contexts? I suspect that it isn't. Any suggestions on using OpenGl efficiently with multiple rendering contexts and sometimes static displays?

Share this post


Link to post
Share on other sites
Thanks for link V-man

So the back buffer contents is unreliable once the buffers are swapped, not surprising really. Maybe the overhead of rendering a static scene with every window repaint won't be too bad anyway, OpenGL being just so fast!

I'll look into FBOs. I also wonder if glAddSwapHintRectWin can help.

Always the same with new tools, tend to flap around a bit until you find out how they work.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this