OpenGL and callback function

In a normal hello world Win32 program, the drawing is usually done in the callback function (under the handler of WM_PAINT message), but in some OpenGL sample code I saw, the drawing is done in the message loop (located in the WinMain function). Is this difference radical? Or is there an equivalent way of doing OpenGL drawing in the callback function? Thanks a lot for help.

Changhai

Hi !

Putting it in the message loop gives you a little more control over the rendering, if you only have it in the paint handler then it depends on Windows redrawing the screen (using InvalidateRect or user interaction), when you do it yourself in the messageloop you can control the animation speed better, for example in a game.

Mikael