1
\$\begingroup\$

I've read a lot about creating graphics with OpenGL in SDL and SFML over the past few days, and I want to know which one I should pick. As mentioned in most of the things that I've read, both allow the programmer to use OpenGL.

However, I want to know which one would serve me best if I wanted to do graphics in OpenGL only. From what I've read, SFML does not work as well with OpenGL as SDL. Is this true?

To reiterate, I will only be using SDL or SFML for features like audio, input, and networking. All graphics will be done with OpenGL code that I write.

Also, I read a bit on LWJGL and LWJGL is essentially what I want, but I am much better at C and C++ than Java so I would like to use SDL or SFML. Which one is most similar to LWJGL?

\$\endgroup\$

closed as off-topic by MAnd, Vaillancourt, Josh Feb 29 '16 at 16:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site. Visit our help center for more information." – MAnd, Vaillancourt, Josh
If this question can be reworded to fit the rules in the help center, please edit the question.

2
\$\begingroup\$

SFML and SDL are both great libraries. I have used them both and IMO are very much interchangeable. The one thing that is very different is the structure of the library itself.

SDL is a C library, and the API is simply a bunch of C functions you can call. SFML is a C++ lib and is OO in nature. If you have a look through the docs, you will notice that right away. This is not to say you cannot or should not use SDL with C++. It just may make more sense for you logically to use them with their native languages.

For me, using SDL with my C projects makes sense since the procedural nature of the library works well with C code (obviously). There is a C binding for SFML as well http://www.sfml-dev.org/download/csfml/ which rewrites the parts of SFML that would not be compatible with pure C.

As for comparisons to LWJGL, just compare the feature lists. I havent used LWJGL much but after taking a quick glance just now it seems to be doing something very similar to SDL and SFML. They are all providing a nice way to access OpenGL, as well as providing convenient ways to accept input, display images, use audio, etc.

Honestly I think you will be happy either way. Take a look at the docs, the community, and the support and just make a decision. They both serve very similar purposes and are 2 sides of the same coin.

\$\endgroup\$
0
\$\begingroup\$

Well, I ended up writing my own abstraction layer. I just found it easier in the end to integrate with OS specific features. For example, in Mac OSX I can take advantage MFi Controllers using the GameControllers Framework.

So I have my OpenGL graphics engine(C++), then an abstract input engine that handles keyboard, mouse and controller. It was easy to port to Windows using GLFW and just implement the abstraction layers as wrappers around GLFW.

Writing your own abstraction layer is a good exercise in OO techniques, if you're into that, and it allows more direct control at the cost of development time.

\$\endgroup\$
  • \$\begingroup\$ About how long did it take you to do that? \$\endgroup\$ – user3567004 Feb 28 '16 at 17:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.