ImagineNation

In pretty much all the tutorials I've ever seen, everyone recommends using OnPaint as your main game loop as this plays nicely with windows and "one or 2 fps won;t impact your game."

Well, if you put your code in a while loop in the main form load event, and add a "application.doevents" it still plays nicely with windows -- perfectly, in fact.

So do you gain a few measly FPS

No -- in fact you gain a whopping 25% FPS increase!!!!

On my video card i go from 2160 FPS average to 2880 FPS average.

So what gives That difference could make or break a video game, and it's hardly the "few fps" I've seen mentioned.

What is everyone else using Are there any caveats to this approach Does this difference scale (EG I''m just displaying a single triangle. Does it in fact even out as the display gets more complex )







Re: Game Technologies: DirectX 101 Why does everybody recommend using OnPaint as your main app loop?

Glenn Wilson

This is the base model for the render loop That I and several others have used in the past. http://blogs.msdn.com/tmiller/archive/2005/05/05/415008.aspx






Re: Game Technologies: DirectX 101 Why does everybody recommend using OnPaint as your main app loop?

The ZMan

Firstly remember that your 25% increase is in an empty loop... the impact in a fully loaded game loop is not the same at all.

Nobody has recommended that loop for a long time though - its main issues are an increase in GC0s due to the DoEvents call. See the history here http://www.thezbuffer.com/articles/185.aspx






Re: Game Technologies: DirectX 101 Why does everybody recommend using OnPaint as your main app loop?

ImagineNation

Thanks I checked it out, very interesting