开发者

Why is SDL so slow and how can I get it to run faster?

I have the following test setup:

  • 1024 * 768 screen surface created with SDL_HWSURFACE
  • The main loop consists only of SDL_Flip() and a simple FPS counter

The problem is:

I am only getting around 1000 FPS开发者_如何转开发 with this. Which is really really low when you consider that you do not even draw anything!

The FPS drop really fast when I continue on to blitting rather large surfaces on the screen as well.

What I wanted to do:

A pixel-per-pixel effects/physics destructible terrain/objects game.

  • Why is SDL so slow? (I have played around for three days with the small example test and eliminated every possible mistake I could have made, so I am quite sure that it actually is SDL's fault)

  • Are there any secret tricks to get it to run faster?

  • Are there other 2D APIs which provide easy and rather fast single-pixel access?


Pixel access it's very slow in hardware surfaces (it's a hardware limit, not a sdl limit).

You can try SFML that it's OpenGL accelerated.


Note that calling SDL_HWSURFACE won't always result in the use of the hardware depending on your graphical card.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜