On Windows, when I display a dialog box (either a custom one, or a standard open/save file dialog), and move the dialog box around over the parent window, the parent window does not redraw, leaving trails of the dialog behind as it’s dragged. (The parent window uses OpenGL to draw, but not sure this is relevant.) How do I get the main window to redraw as the dialog is moved in front of it?
I tried adding a call to redraw my main window whenever the dialog’s callback is sent a message, but this only causes redrawing to occur whenever a button is pushed or an edit field is typed in. It doesn’t redraw when the dialog’s window is moved. How can I detect this movement?
I suspect your opengl app is just using a window for the explicit purposes of rendering via opengl onto it, and then goes into a tight loop of checking for mouse/kb input followed by a redraw of the opengl surface. An I’m guessing you are not pumping messages after drawing a frame. And more importantly, that little stub WndProc you setup for your window, probably doesn’t have a WM_PAINT handler.
Two things to consider. Your WndProc for your main window needs to catch WM_PAINT, redraw, and validate the surface. That is….
Instead of calling BeginPaint/EndPaint to handle WM_APINT above you could likely just call ValidateRect.
And preferably, you are catching other window messages in your draw loop. That way, if a window gets obscured by something else outside of your app (e.g. resize operation, minimize/restore, other windows app takes foreground, etc…), then you can handle the repaint notifications as well.
A typical game tries to pump 1 message per drawing frame.