Updating multiple GL view windows

Help!
Anybody have any ideas on how to update (dynamically) multiple opengl rendering windows all rendering the same scene. If i make a change to one , I want it to reflect in all the windows concurrently.

I’m not sure how to handle the rendering context(s) and how double buffering is gonna work with this sort of setup.

Anybody been in this situation and have some pointers?

OK, this answer will have to assume certain things (since you neglected to mention them):

  1. you are using Win32.
  2. the multiple windows are actual Win32 windows, not simply glViewport changes.

It is fairly simple. Create a global function that will call each window’s drawing function when it is called. Each window’s drawing function should set that window’s rendering context to current before drawing. Then, whenever a window updates, use that global function to redraw all of the windows.

If you’re using MFC (and a document-view interface), it is even easier. When a View changes, call a particular document function. All this function does is call UpdateAllViews, which will call each view’s OnUpdate function. You should use this to Invalidate that view and thus force a call to OnDraw (which should set that View’s rendering context to current).

Thanks for that- I’m going to try it now.

The assumptions are correct. Multiple windows running under win2k.

Would you call swapbuffers once in that global function or in each of the views draw functions?

Thanks again for the prompt reply.