Menu

29 April 2011

Comparing SDL and GLUT - Please don't use Super Outdated Borland TC3 graphics.h , use OpenGL

Almost everycollege of India is using ridiculously old and super outdated TC3..

---------- Forwarded message ----------
From: karan pratap singh <wizard.karan@gmail.com>

On Thu, Apr 28, 2011 at 10:38 AM, Anoop Jacob Thomas <anoopjt@gmail.com> wrote:
> For people using BGI Graphics in Turbo C (graphics.h), it is easy to use
> Allegro. I have suggested this as an alternative in the college where I was
> teaching before. It is very much similar to BGI, very simple to learn and
> practice the graphics primitives.
>
> As a replacement to BGI Graphics (graphics.h), Allegro is the best.
http://alleg.sourceforge.net/
 
Our college too uses the Super Outdated( read useless! ) Borland graphics.h. I was NOT OK with this, so I asked my teacher permission to use
OpenGL, to which she agreed with enthusiasm!

Now the thing is that OpenGL just does the rendering part of a graphical application, but it does not create/manage the actual program window.
So we have got 3rd party libraries to manage the windows and other Operating System integration features like, taking user Input, Using sound etc.

The 2 popular Window management libraries used with OpenGL are SDL and GLUT:
I did a lot of research a few months back, comparing SDL and GLUT...

Here is what I found out through personal use and many forums from the internet as well as the OpenGL IRC channel:

GLUT PROS:
  • 1) GLUT is very easy to use for small projects!
  • 2) The official OpenGL Programming Guide aka the Red Book has example code using GLUT.
  • 3) Many universities worldwide use GLUT, because it was the standard before SDL arrived!

GLUT CONS:
  • 1) GLUT is only suitable for individual TOY or DEMO graphical applications.
  • 2) GLUT teaches wrong programming habbits.
  • 3) GLUT does not handle SOUND/USER INPUT afaik, please correct me if I am wrong on this point!

SDL PROS:
  • 1) Is suitable for full fledged Graphical Applications.
  • 2) Logical and Intuitive to understand once you have grasped the basics.
  • 3) Good documentation, but sometimes the documentation can be a bit difficult to understand.
  • 4) Has an active online community which will readily help you out!( I have verified this :) )
  • 5) Can easily handle sound, custom fonts as well as user input events.
  • 6) You can easily make video games using SDL and OpenGL.
  • 7) Plenty of source code examples of SDL+OpenGL apps can be found on the internet.

SDL CONS:
  • 1) A bit difficult to learn at first, but is worth the effort.

Since then I have stuck to C++/SDL/OpenGL and have achieved excellent results!

Tutorials?
I study OpenGL from The Red Book, but instead of using GLUT I use( and highly recommend! ) SDL

For learning SDL the best place on the internet is:
www.lazyfoo.net

It will take you only about a week to grasp SDL basics and get comfortable in using SDL.

I also took a look and used Allegro for sometime, Indeed it is very familiar with graphics.h, but then You Don't get to learn much about Computer Graphics Programming by using it.....whereas by using OpenGL, you gain relevant experience in OpenGL which reflects well in your skill-set as well adds another star to your resume!( Did I mention that teachers think that you are super cool! and may even award you some grace marks! ;))

Final Point: Learning to use OpenGL and graphics programming without understanding the Computer Graphics theory concepts will do you no good! So do not sleep in your Computer Graphics class :)

from
Karan Pratap Singh
PULUG
Panjab University, Chandigarh
IRC nick: kps_foo

By- Narendra Sisodiya

Post a Comment