wglMakeCurrent() and multiple windows

I’ve got an MDI rendering application which is having problems. Most of time it runs fine, rendering into multiple windows, with some display lists. However, there are some conditions where MessageBoxes are displayed during the rendering process. Also happens during debugging if I have a breakpoint, causing task switching to the debugger during drawing.

If this occurs, the image that caused the message box actually appears in a different window!

E.g. View1 renders a cube, view 2 renders a circle. If view1 pops a message box before rendering the cube, the cube appears in view 2, and view 1 stays how it was. Also occasionally causes crashing, I guess depending on the exact conditions of when it occurs.

In my CGlView class, at the start of the rendering operation, called from OnDraw(), I call wglMakeCurrent() to set the rendering context, but it seems that if a second window starts drawing, then it steals the opengl rendering context.

Anyone got any suggestions on how best to resolve this?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.