Author Topic: What's the best simple graphics library for C++?  (Read 20859 times)

miki151

  • Rogueliker
  • ***
  • Posts: 264
  • Karma: +0/-0
    • View Profile
What's the best simple graphics library for C++?
« on: July 24, 2013, 12:25:17 PM »
I've used Allegro for many games, because it was simple and had low hardware requirements. When making my recent game, I started with Allegro 4.x, but had to switch to Allegro 5 due to better unicode font support. But now trouble has started, on some Windows PCs the game runs really slow, due to problems with hardware acceleration and/or D3d, and doesn't start at all on a Windows 7 on Vmware. Furthermore, there are performance issues, as some drawing primitives are much slower than in Allegro 4.

Does anyone have any recommendations on a simple library that doesn't get in the way too much? All I need are drawing primitives, bitmap and truetype fonts support, and portability between Linux and Windows. I know many people use libtcod, but I think it's too constraining for my needs, as I'd like to be able to draw anything I want on the screen, as opposed to using a pre-made console. But maybe I'm wrong about it. And I don't know how well it runs on older computers.

KeeperRL, Dungeon Keeper in roguelike style:
http://keeperrl.com

TheCreator

  • Rogueliker
  • ***
  • Posts: 370
  • Karma: +0/-0
    • View Profile
    • Fame
    • Email
Re: What's the best simple graphics library for C++?
« Reply #1 on: July 24, 2013, 12:56:22 PM »
You can try SFML or SDL, but what I'd really recommend is to make a harder drill into Allegro 5. Or at least do not expect that with another library everything will be smooth. Sometimes it is, but causes more trouble elsewhere. Every library has its dark side. The sooner you get used to it and learn how to solve common problems, the better. It's worth to note that some problems (including performance degradation!) are very similar with every library.
Fame (Untitled) - my game. Everything is a roguelike.

daver64

  • Newcomer
  • Posts: 16
  • Karma: +0/-0
    • View Profile
    • Indigo
    • Email
Re: What's the best simple graphics library for C++?
« Reply #2 on: July 24, 2013, 01:07:00 PM »
I use Allegro 4 and Alleggl. The Alleggl gives accelerated drawing via OpenGL, and I find the combination very easy to use although it does require familiarity with OpenGL itself of course.

miki151

  • Rogueliker
  • ***
  • Posts: 264
  • Karma: +0/-0
    • View Profile
Re: What's the best simple graphics library for C++?
« Reply #3 on: July 24, 2013, 01:35:14 PM »
Yup, I used Allegro 4.x with Allegttf that and it worked really well, except that it wouldn't draw many unicode symbols.
KeeperRL, Dungeon Keeper in roguelike style:
http://keeperrl.com

eclectocrat

  • Rogueliker
  • ***
  • Posts: 81
  • Karma: +0/-0
  • Most of your personality is unconscious.
    • View Profile
    • Mysterious Castle
    • Email
Re: What's the best simple graphics library for C++?
« Reply #4 on: July 24, 2013, 01:37:25 PM »
Best is flamebait :)

I like SDL because it is getting active funding and support from Valve (The Steam dudes), it supports a lot of environments and is really mature.

There is definitely a case to be made for other systems, but I like that SDL has been around for so long and still has very active development. SDL2 supports OpenGL and DirectX out of the box.

My 2 cents.

miki151

  • Rogueliker
  • ***
  • Posts: 264
  • Karma: +0/-0
    • View Profile
Re: What's the best simple graphics library for C++?
« Reply #5 on: July 24, 2013, 01:43:48 PM »
I might go the SDL way. Will it work fine on weaker computers, like netbooks that many people use nowadays?
KeeperRL, Dungeon Keeper in roguelike style:
http://keeperrl.com

TheCreator

  • Rogueliker
  • ***
  • Posts: 370
  • Karma: +0/-0
    • View Profile
    • Fame
    • Email
Re: What's the best simple graphics library for C++?
« Reply #6 on: July 24, 2013, 01:47:28 PM »
I might go the SDL way. Will it work fine on weaker computers, like netbooks that many people use nowadays?

If you code your game properly - yes, it will ;).
Fame (Untitled) - my game. Everything is a roguelike.

Quendus

  • Rogueliker
  • ***
  • Posts: 447
  • Karma: +0/-0
  • $@ \in \{1,W\} \times \{1,H\}$
    • View Profile
    • Klein Roguelikes
Re: What's the best simple graphics library for C++?
« Reply #7 on: July 24, 2013, 01:50:32 PM »
I've been using SFML for some time now. It's not as mature as SDL, but its maintainer is very active and helpful on the forums, documentation is very good, and the object-oriented interface is a lot nicer to program in than SDL. Version 2.0 was finally released not long ago, after a long time in RC state.

eclectocrat

  • Rogueliker
  • ***
  • Posts: 81
  • Karma: +0/-0
  • Most of your personality is unconscious.
    • View Profile
    • Mysterious Castle
    • Email
Re: What's the best simple graphics library for C++?
« Reply #8 on: July 24, 2013, 02:20:01 PM »
I think that if you want simpler (to use) you might want to go with SFML, I've heard a lot of good things about it. If you want to ensure portability to a maximum number of platforms (desktop/phone), then SDL may be a better choice.

Like I said, 'best' is flamebait :)

miki151

  • Rogueliker
  • ***
  • Posts: 264
  • Karma: +0/-0
    • View Profile
Re: What's the best simple graphics library for C++?
« Reply #9 on: July 24, 2013, 02:43:19 PM »
Come on, I wouldn't expect a flamewar over a graphics library... Or am I just new to the Internet  ;D

Anyway, thanks for recommendations, I'll try out SFML then maybe.
KeeperRL, Dungeon Keeper in roguelike style:
http://keeperrl.com

Anvilfolk

  • Rogueliker
  • ***
  • Posts: 374
  • Karma: +0/-0
    • View Profile
Re: What's the best simple graphics library for C++?
« Reply #10 on: July 24, 2013, 03:32:28 PM »
I hadn't realised SDL2 was also about to come out and with hardware support and all that, but SDL just felt a lot more low-level than SFML ever did. It required lots of extra libraries to do stuff like rotations and so forth. I am sure SDL 2.0 is better, but I do really like SFML's API. I'm currently using PySFML. I have a major gripe in that it doesn't support drawing a line, which is annoying, but maybe SFML does?

"Get it hot! Hit it harder!!!"
 - The tutor warcry

One of They Who Are Too Busy


kraflab

  • Rogueliker
  • ***
  • Posts: 454
  • Karma: +0/-0
    • View Profile
    • kraflab.com
Re: What's the best simple graphics library for C++?
« Reply #12 on: July 24, 2013, 05:00:15 PM »
sfml is beautiful

Quendus

  • Rogueliker
  • ***
  • Posts: 447
  • Karma: +0/-0
  • $@ \in \{1,W\} \times \{1,H\}$
    • View Profile
    • Klein Roguelikes
Re: What's the best simple graphics library for C++?
« Reply #13 on: July 24, 2013, 08:45:44 PM »
The only problem with it is it sounds like Super FML.

Anvilfolk

  • Rogueliker
  • ***
  • Posts: 374
  • Karma: +0/-0
    • View Profile
Re: What's the best simple graphics library for C++?
« Reply #14 on: July 24, 2013, 11:23:22 PM »
That made me laugh out loud :D
"Get it hot! Hit it harder!!!"
 - The tutor warcry

One of They Who Are Too Busy