开发者

SDL vs SFML using C when portability matters most? [closed]

开发者 https://www.devze.com 2023-03-24 19:24 出处:网络
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing th
Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 7 years ago.

Improve this question

I have been doing a lot of reading on SDL and SFML, and no doubt have missed some information or am not understanding it. Here is what I have gleaned:

  • SDL is presently the standard (most popular)
  • SDL uses C and software rendering (which is slow?)
  • SDL embeds on everything?
  • SFML is becoming more popular
  • SFML uses C++ (but has C bindings) and utilizes hardware accelerated rendering (fast)
  • SFML won't embed on everything?

I have to use C and OpenGL for what I want to do. I also need to make sure that the program is as portable as possible. It cannot be slow however.

What开发者_C百科 should I do?


When using OpenGl with SDL, rendering is done by the hardware, not in software. I never tried SFML, but SDL is very simple and it is a mature library. Having wrote some OpenGl with SDL, the only problem I faced is that it is not possible to have multiple windows with SDL. Regarding portability, my program worked on Linux, MacOS and Windows. For the moment, I don't have any reason to switch to another library.


SFML is a more mature library. It works well, probably even better than SDL on Windows, Linux, Mac OS:

SFML compiles on standard platforms like Windows (98, 2000, XP, Vista) and Unix systems (Linux, Mac OS X). As the library grows up, support for more operating systems will be added.

Also, SFML has been supporting hardware acceleration from the start, whereas with SDL there are some doubts about that.

However, SDL works on more platforms right now, including mobile ones.

And using C language you may not benefit from all the object-oriented goodness of SFML.

So you should use SDL with C (or for mobile platforms) and SFML with C++.


So you want to do 2D stuff? Don't break your head with OpenGL, just use SFML! It uses OpenGL and hardware acceleration internally for 2D.


Since you say that you have to use C I would suggest you go with SDL. When using OpenGL with SDL it will be hardware accelerated. Only the SDL 2D graphics functions will be in software but since you use OpenGL you won't use them to draw anything on the screen.

SDL is pretty portable and SDL 1.3 (from svn or archive on the homepage) can also be compiled for Android where you use OpenGL ES.

0

精彩评论

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