[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SDL vs GLUT
- To: firstname.lastname@example.org
- Subject: Re: SDL vs GLUT
- From: Steve Baker <email@example.com>
- Date: Mon, 17 Jun 2002 22:06:34 -0500
- Delivered-To: firstname.lastname@example.org
- Delivered-To: mailing list email@example.com
- Delivery-Date: Mon, 17 Jun 2002 20:35:35 -0400
- Mailing-List: contact firstname.lastname@example.org; run by ezmlm
- Organization: Steve at Home
- References: <200206171949.PAA29603@fit.edu>
- Reply-To: email@example.com
- User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529
> I was reading an earlier thread about OpenGL vs SDL for 2D, and it ended in
> saying that OpenGL is considerably faster than SDL in almost all cases simply
> because of hardware optimization.
> Then came up a mention of GLUT, and as I see
> it, GLUT and SDL are similar in that they're both utility toolkits.
> My question:
> What exactly are the differences between GLUT and SDL?
Well, there is some overlapping of 'levels' and crossing of boundaries
OpenGL provides *only* fast, 3D or 2D drawing commands - nothing else.
GLUT layers on top of OpenGL and provides mechanisms to deal with opening,
closing, resizing windows, keyboard and mouse I/O and a *very* crude menu system
that's really not much use. It doesn't address Audio at all, it's joystick
functions are pretty crude and it's efforts at text rendering are sadly lacking.
SDL provides all of the low level rendering for 2D - and allows you to interface
to OpenGL for faster 2D and 3D rendering - it also provides a *bunch* of other
libraries that cover just about every other low level interface you could think
of - like sound, etc.
There are also numerous other libraries that extend OpenGL+GLUT up to the level of
SDL - and beyond. My own PLIB package aims to fill in or replace the poor things
in GLUT (I have new joystick, menu and font routines) - and extend into areas
such as sound and music - and then add more layers of sophistication such as
3D file I/O, scene graph rendering, high level graphic primitives such as
particle systems and skin & bones character animation. PLIB is only one example
of such a system - there are many others.
It's a bit like buying a HiFi system used to be - you could buy an all-in-one
system like a boom-box - or you can go for a 'component' system and get the
speakers from one place, the amp from another and so on.
Whichever route you go, (IMHO) you should have OpenGL in there for all your
rendering. It's fast, portable and growing in power as the hardware extends
> I've been reading through the GLUT docs, and from what I see:
> Both are ported to at least Linux and Windows (SDL is a lot more, but those are
> my main targets)
GLUT runs on every system that OpenGL runs on (AFAIK) - it's a lot more portable
> Both offer high-level routines for initialization, windowing, event processing,
> GLUT uses callbacks for its events whereas SDL are "call-forwards?"
> SDL offers blitting, and working with surfaces, wheras (I assume) with GLUT,
> I'd just be using OpenGL.
Well, "just" be using OpenGL includes blitting and such. "Working with surfaces"
is a somewhat different paradigm than OpenGL. In OpenGL, you tend to re-render
the entire scene every frame (which is easy because it's so fast) - and deal
with any 'layering' using the Z buffer. Once you've worked the OpenGL way,
you wouldn't want to go back.
> SDL offers a lot more other routines, that GLUT/OpenGL doesn't, or at least
> doesn't seem to (ie, reading image files, audio output, etc)
Right - but that's where the third tier support libraries (like PLIB) come in.
However, you can still use OpenGL for rendering withing SDL and ignore SDL's
own graphics primitives.
> What other differences are there?
It's hard to talk about differences when the two libraries are simply working
at different levels. You could talk about SDL versus OpenGL+GLUT+PLIB or SDL+OpenGL
versus OpenGL+GLUT+PLIB - but talking about 'GLUT' versus 'SDL' is like trying
to compare the engine from a Lexus with an entire BMW - it's not fair to say
the Lexus engine doesn't come with comfy seats....Duh! It's just an engine. GLUT
doesn't come with audio routines because it's a window management library.
> I've been learning SDL (from reading Programming Linux Games) but after reading
> that thread, I figure I might as well just start working with OpenGL, so I can
> get optimized 2D and then only add a few more things for 3D graphics. I know I
> can use SDL with OpenGL, but I kinda like the GLUT callback features, and might
> just look into using it instead.
GLUT is certainly a very gentle learning curve - and it leaves open your choice
of higher level layers (or just doing it yourself - which is perfectly practical
for 2D games).
> Furthermore, are there any recommendations for books on OpenGL, preferably one
> that doesn't focus on a specifc OS?
The *only* OpenGL book to read is the most excellent 'Red Book' - which is:
OpenGL Programming Guide
The Official Guide to Learning OpenGL
By: The OpenGL ARB
It's written by the OpenGL Architecture Review Board (ARB) who are the guiding
committee that oversee the API. Hence it's authoritative. It's also unusually
well written and organized for something that's written by committee! Like
OpenGL itself, it's completely OS-independent - and all of it's examples use
GLUT. There are three other books in the series (identified by their cover
The "Blue Book" - which is a hardcopy print of all the OpenGL and GLUT man pages.
The "Green Book" - which focusses on GLUT and the X-windows interface.
The "Alpha Book" - (which actually has a white cover) which focusses on the
IMHO, those are all a waste of money - get the Red Book and you'll have all
I've been using OpenGL since before it's first public release and I own two
copies of this book (one sits by my desk at work and the other is currently
battling with my mouse-pad for space on my desk at home).
Make sure you get a recent version of it.
----------------------------- Steve Baker -------------------------------
Mail : <firstname.lastname@example.org> WorkMail: <email@example.com>
URLs : http://www.sjbaker.org
http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net