Jump to content

  • Log In with Google      Sign In   
  • Create Account


DirectX or SFML or SDL? c++


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 infernapelover   Members   -  Reputation: 160

Like
2Likes
Like

Posted 29 August 2012 - 01:47 PM

Which is better for game dev in c++, the directx,SFML or SDL library? I'm planning to make a rpg, starting 2d and evetually becoming 3d.
I know that directX is more used, but its really advanced for me, its taking me quite a while to understand code.
So I thought, let me check out more basic libaries, this led me to SDL and SFML? Which of these two is better?
Is directX that much better than these two libraries?
wouldn't it be hard to learn SFML and then have to reprogram the whole thing in directx for the 3d version later on.
Thanks in advance for any advice.

edit: Thanks everbody, i think ill look into SFML.

Edited by infernapelover, 30 August 2012 - 11:34 AM.


Sponsor:

#2 caldiar   Members   -  Reputation: 702

Like
4Likes
Like

Posted 29 August 2012 - 02:05 PM

DirectX is a lower-level API for interacting with the graphics device.

SFML and SDL are higher-level graphics libraries which simplify a lot of tedious work involved in using a lower-level API like DirectX or OpenGL directly.

SFML and SDL both sit on top of OpenGL. I don't have any experience with SFML but it, as well as SDL, have the ability to let you directly write OpenGL code if you'd like to dig into some more advanced stuff that neither library provides a simplified method of doing.

I believe neither SFML nor SDL are better than one another. It's just a preference - like OpenGL vs DirectX (ignoring cross-platform arguments and special use-cases).

I'd personally recommend using SDL. I know for a fact there's plenty of great tutorials on getting started with it and it's fantastic for 2D games. Later on you can jump into 3D graphics programming by using the OpenGL bindings with SDL.

Check out http://lazyfoo.net/S...rials/index.php for some quick, easy, well-written tutorials on setting up and using various parts of SDL.

SFML seems to be under active development though and has some interesting features to it.

Grab one, run with it, follow the intro tutorials and play around.

Edited by caldiar, 29 August 2012 - 02:09 PM.


#3 Dunge   Members   -  Reputation: 405

Like
2Likes
Like

Posted 29 August 2012 - 02:11 PM

SDL is not only "sitting on top of OpenGL". It have complete 2d drawing functionality by itself. I use it directly on the linux framebuffer on a embedded arm device with no graphical hardware acceleration.. The OpenGL part of it is simply a wrapper on top of SDL to simplify using OpenGL without having to deal with the Win32 API. In your tutorial website, only the Lesson 36 start talking about OpenGL.

#4 caldiar   Members   -  Reputation: 702

Like
1Likes
Like

Posted 29 August 2012 - 02:25 PM

Indeed, it has software rendering abilities. However, as the OP mentioned an intention to transition from 2D to 3D at a later point of time it seemed safe to assume that OpenGL (if either of the libraries were chosen) would be used at that point.

With that in mind, I'm pointing out that SDL and SFML are going to be dishing up their more powerful graphical goodness through exposure to OpenGL, rather than DirectX. This isn't to say that you can't use DirectX with either of them, it's just that the libraries, as you said, have a wrapper specifically for interacting with OpenGL.

The tutorial site only mentions OpenGL near the end probably because it's not something most people need to know immediately when jumping feet first into learning SDL. I don't know though since I didn't write the tutorials on that site.

#5 mongrol   Members   -  Reputation: 118

Like
2Likes
Like

Posted 29 August 2012 - 06:25 PM

For starting out I'd recommended SFML. It's much more accessible for a beginner having a smaller, tighter and very responsive community. The sfml-dev.org tutorials are excellent. It's also a pure C++ API whereas SDL is C. It's also always been OpenGL from the start.

SDL is in the transition to 2.0. the available tutes, althought many, are confusingly unlabelled for which version they're for. Likeways the documentation is plentiful but confusing for a beginner. It's just less accessible.

#6 AdrianC   Members   -  Reputation: 602

Like
2Likes
Like

Posted 29 August 2012 - 07:41 PM

I also recommend SFML. A few years back I had to choose between SDL and SFML. Tried both and found SFML a lot easier to get started with. From what I remember you had to write a whole bunch of lines of code just to get SDL running, where as SFML only needed a few. I also found SFML to be more clean and organized, and generally a lot easier to understand.

Now in regards to DirectX, whether you should use it depends on what your goals are. Do you want to make games, or do you want to understand every little thing that goes on behind the scenes. If you want to make games, I don't recommend DirectX as it will take you too long to get anything done. Pick an engine like unity, or a library like Ogre3D if you just want to make 3d games. Your knowledge from SFML will transfer over quite nicely.

#7 TheVirtualDragon   Members   -  Reputation: 237

Like
2Likes
Like

Posted 30 August 2012 - 05:39 AM

I advice SFML. It is not just good for beginners, but also provides flexibility and options to advanced users. That said, it's API is easy to understand, clean and object orientated. You can integrate it too OpenGL very easily as it is built from OpenGL. As a result, it is also faster than SDL because of hardware acceleration.
Both SFML and SDL are transiting to their 2.0 versions (SDL 1.2 to SDL 2.0 and from SFML 1.6 to SFML 2.0). I would advise you to use SFML 2.0 as it is in it's RC stage and it's API isn't that different from SFML 1.6 - which means that you can follow the SFML 1.6 tutorials. SFML also has quite a good forum if you need help.

P.S. I do not have any experience at all with SDL, or with it's website and forum.
What's This?: basically, it's my blog. Click on it.

#8 caldiar   Members   -  Reputation: 702

Like
1Likes
Like

Posted 30 August 2012 - 01:25 PM

As a result, it is also faster than SDL because of hardware acceleration.


SDL also supports hardware acceleration but it's just not enabled by default. When you compare SDL's software rendering to SFML's hardware-accelerated renderinig SFML is going to blow SDL out of the water. You should find they're pretty close to each other when both are in hardware-accelerated mode.

It seems like the general consensus is to go with SFML so I'll back that. I've just had no experience on it so couldn't give an opinion on it one way or another.

#9 DujekC   Members   -  Reputation: 161

Like
1Likes
Like

Posted 30 August 2012 - 04:55 PM

I haven't tried SDL but I'm a beginner too and have been using SFML. I just made the transition from 1.6 to 2.0 after making a few projects in 1.6 and nothing really major changes so I'd recommend starting with 1.6 (which has tutorials) then switching once you're familiar with it.

#10 frazchaudhry   Members   -  Reputation: 1130

Like
1Likes
Like

Posted 30 August 2012 - 11:16 PM

Another vote for SFML from me. Im a beginner myself and have chosen to go with this API, for mostly the reasons described by posters above. I took a look at both of them myself too and just found SFML easier and more intuitive. I had previously made a pong clone using C++ and the win32 API and it was hard work getting even a window up and I had to write a lot of code to get something to draw. I was blown away when I checked out the tutorials for SFML and saw how easy it was to get a window up and draw something.

Edited by frazchaudhry, 31 August 2012 - 12:55 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS