Advertisement

SDL vs. GLUT

Started by February 12, 2003 08:07 PM
22 comments, last by enigmamwu03 21 years, 9 months ago
I am trying to decide between using SDL and Glut. As far as I have seen they both have their benefits but neither has anything for buttons, check boxes, text boxes, or any other thing of that sort except that Glut has pop up menus. I would like the insight of you all to help me decide which of these to use.
SDL and OpenGL both have GUI libraries out.

SDL is for 2D stuff (haven''t seen any 3D stuff in it yet.. I may be wrong).
Advertisement
They both support many platforms and they each have their own pros and cons. Both support Joysticks and can used with OpenGL. Glut has better support for printing text while SDL supports sound (Glut doesn’t).

Neither library comes with GUI type controls, in general you have to write those components yourself or use a library that someone else has written.

If you just learning OpenGL then I would recommend Glut.
Just learn OpenGL. You don''t want to have a dependency on some 3rd party library just because you got lazy.
SDL does have 2d drawing functions, but it can be used to create an OpenGL window.
SDL also has a very nice input system, and through add-ons has great audio & JPEG/PNG/etc loading.

I often use SDL even if I''m not using the 2d library, it''s a great way to get an OpenGL window up on screen fast, and provides a great input system. (I personally find it simpler than GLUT,which is surpising since GLUT is supposed to be for learning OpenGL.)
It''s also more advanced than GLUT, since it provides sound & joystick control, unlike GLUT.


neurokaotix: Without SDL (or something like it) you''re stuck on one platform. If you want portabillity then you''ve got to write versions of your start up code for multiple platforms, as well as input. Once you''re done, you''ve duplicated SDL (or ClanLib, or Allegro).

Even if you''re programming for windows only, SDL is nice since you don''t have to worry about debugging window creation & input.
What, you think there wasn't game portability prior to SDL? I know you would have to write separate code for other platforms, thats a given. 3rd party API wrappers for beginners are not a necessary part of game development.

[edited by - neurokaotix on February 12, 2003 11:49:05 PM]
Advertisement
I have this to say ... if you want to learn something fast, and just one thing, to let you make simple games, easily ... use GLUT - why, because it isn''t really meant to be a full featured library for shipping games, it''s meant to be a quick-to-learn, quick-to-use helper lib. As soon as you have outgrown it''s features, you will also have no problem learning another API (it only takes 1 week to learn GLUT, so why worry about not using it a year from now - after you''ve made complete games even)

SDL I actually use a little myself, and while I like the basic idea, I think getting sound and stuff working was all a little too hard for a first timer (and I''m not, I''ve written a full, although simple, DirectX 6 gambling game). I mean it only took 2 days, but 2 days to get sound working when you already know DirectSound ... that''s not a beginners RAD tool to me. I actually found OpenAL to be quicker to get up and running than anything else so far.

For my current project, we are using DirectX and OpenGL ... and here''s why.

... OpenGL because it''s powerfull, mature, cross-platform, and well supported ... the only other choice is Direct3D, which is fine, but who wants to be tied to MS more than absolutely necessary ... I certainly hope and expect that the consoles out their (PS2, Gamecube, etc) support OpenGL.

... DirectX for the rest because - multimedia on any platform but windows and mac (and consoles) is an absolute pain in the ass, to learn, to install, to setup, etc

... OpenAL seems likely to help on the sound front, but not yet (check back in 3-9 months, when your starting your next game(s) ... it will probably be worth it then)

... as for networking, there are so many simple choices, DirecPlay is easy, MUSCLE is easy, hell sockets are easy ... the trick is not the technology, but the way you use it ... it''s so damn hard to make a game that handles variable bandwidth and lag in a consistent and acceptable manner, you need to spend some serious thought on your design and how it will interact with lag ... like what to do with lost packets showing up latter, or who to penalize for slow connections

... DirectInput for joysticks and such, because I simply don''t know of any usefull alternatives ... please someone post and tell me what you use on Linux, Mac, or with the SDL etc ...

BTW ... the real reason we learned OpenAL in the first place, was because our SDL sound test worked wonderfully on BeOS, but made nasty pops and hisses on Windows ... using the same damn sound card ... now you can''t blame the Windows drivers when they work just fine for My OpenAL test, my DirectSound game, and DirectMusic test. Somethings was seriously wrong with the basic buffer management or locking mechanism (3 months ago, hope it''s fixed soon).
quote: Original post by neurokaotix
3rd party API wrappers for beginners are not a necessary part of game development.


Agreed, but it''s a big help.
I''ve found sometimes it''s best to keep beginners away from win32 or X programming, at least for a while. SDL + OpenGL is a much "cleaner" API imo (and thus easier to understand).
win32 / X can be learnt later.
I dunno, I've always hated using wrappers like that, I figure if you're going to do it, do it . And that it would be kind of hard to go from easy methods brought on by the wrapper to the more complex methods of the actual API. Thats why's I've never, and probably never will, touch MFC.

Edit: Also because I hate the feeling of having some extra dll's and added weight/overhead added to the project. If its not needed, scrap it lol

[edited by - neurokaotix on February 13, 2003 4:19:05 AM]
I wouldnt touch the Win32 API directly with a 10 foot pole, thats how ugly i think it is(im not a fan of hungarian notation) Thats why i stick with SDL + OpenGL, SDL hardly messes at all with the OpenGL API, you use it 99.99% the same as you would without SDL. What it does hide, though is windows setup stuff like the Win32 API, which i cant really see any sense in learning for game programming.
For sound and inputyou can do what want, but SDL has a pretty simple and easy interface and can handle the DirectSound/Input(or other input stuff on other OS''s) stuff for you.

While SDL is very simple to use, GLUT provides a *very* easy framework for testing various aspects of OpenGL while learning.
So just use GLUT, then discard it when you start actually making anything but a very simple game.

This topic is closed to new replies.

Advertisement