Do I want to Swap buffers when I handle the WM_PAINT msg or at the end of my WinMain?

After you do your opengl rendering, inside WM_PAINT seems like the logical place to me.


U can swap buffers in wm_paint (optional) but u have to swap buffers after ur done with ur scene. Because WM_PAINT wouldn’t get called as often as ur rendering function.

You can call SwapBuffers anytime you want. If you are doing some sort of animation, then after you render each frame you can go ahead and call it, regardless of the WM_PAINT message. If you only need to update the scene when your window is changed then WM_PAINT will let you know, and you can go ahead and call SwapBuffers.

For editing programs (ie. shader editor, world editor, etc) I’m using WM_PAINT for handling the rendering because it doesn’t use 100% of the CPU time that way.

For games/techdemos/demos I’m NOT using WM_PAINT because it should be as FAST as possible…
(and letting WM_PAINT handling your rendering is definitely NOT fast enough)

Yeah, is should have worded my question a little better. It was the whole WM_PAINT msg not getting handled every frame. So I should probably be swapping buffers right at the end of my rendering code. But know I make sure I handle every single msg in the queue each frame.