Advertisement

SDL - a few questions

Started by December 19, 2004 10:11 AM
10 comments, last by Drew_Benton 19 years, 7 months ago
Hi, I was thinking about SDL to ease myself into more complicated programming topics, and I found OpenGL a bit much at my stage in the game, so to speak. However, I have a few questions: Is it easier that OpenGL/DirectX? What do I need to download to use it (I have MSVC++ 6.0 Standard, what headers/libraries do I need?) What do you use it for yourselves, or is it obsolete? Thanks in advance for any help you can offer me.
Quote: Original post by ukdeveloper
Hi, I was thinking about SDL to ease myself into more complicated programming topics, and I found OpenGL a bit much at my stage in the game, so to speak. However, I have a few questions:

Is it easier that OpenGL/DirectX?
What do I need to download to use it (I have MSVC++ 6.0 Standard, what headers/libraries do I need?)
What do you use it for yourselves, or is it obsolete?

Thanks in advance for any help you can offer me.


SDL is a great way to start. The function names all make logical sense, and it's easy to get something up and running quickly. That being said, it does have its drawbacks.

On Windows, SDL wraps a VERY old version of DirectDraw and since it is such an old version and newer versions draw things in different ways, the support for newer cards is a little sketchy. For example, I wrote an SDL version of pong that ran at about 80 fps on my machine. My machine can run Doom 3 at 800x600 with high EVERYTHING turned on at ~50 fps. On my laptop, which has a much older video card and can't run Doom 3 at all, Pong ran at 200 fps. So, your mileage may vary.

It depends on what you're doing, really. SDL is great if you're sticking to 2D. But the prevailing opinion around here seems to be in favor of using SDL for sound / input, and using OpenGL as a renderer. SDL enables you to set up an openGL rendering context to draw to, then you just call openGL code instead of using SDL's blitting routines. Even when doing 2D, using a combo of SDL / OGL is likely to be faster on newer cards, since newer cards are optimized for use with openGL / DirectX.

My advice: write a small game in pure SDL, but try to keep the drawing code as encapsulated as you can. Then when you feel comfortable with the basics of games design in general, go back and convert all your drawing routines to openGL. It only took me a couple of days to get a decent handle on the openGL basics. It's not really any more complicated than SDL.

There is a great walkthrough for setting up SDL for use in VC++ linked from the SDL site:

http://pgdc.purdue.org/sdltutorial/sdl_setup.html

Er. Just noticed that's for VS.NET, but you should be able to do basically the same thing on 6.0.


Good luck.
Advertisement
Quote: Original post by ukdeveloper
Is it easier that OpenGL/DirectX?


Maybe. The initialisation code is definitely easier than OpenGL / DirectX (unless you use another lib which sorts it out for you).

The software rendering supported by SDL uses an older DirectDraw interface on Windows - this works fine but might be removed at some point (from Windows, not SDL).

Hardware rendering using SDL is usually via OpenGL.

Quote:
What do I need to download to use it (I have MSVC++ 6.0 Standard, what headers/libraries do I need?)


You need to download the SDL development package (which should include all the right lib files etc and headers), and you *possibly* *might* need to download the DirectDraw development kit. But I think it's bundled with VC6 (which is pretty old now).

Mark
Quote: Original post by ukdeveloper
Is it easier that OpenGL/DirectX?
Very much so. Although by using strictly SDL, you are limiting yourself to its capabilities. The great thing about SDL is that you can use the OpenGL libraries in addition to the SDL libraries. Makes quite a powerful combo.

Quote: Original post by ukdeveloper
What do I need to download to use it (I have MSVC++ 6.0 Standard, what headers/libraries do I need?)
The Win32 VC6 Development Library. Read through the documentation on how to get it set up.

Quote: Original post by ukdeveloper
What do you use it for yourselves, or is it obsolete?

I just finished my Tetris clone using SDL. I also have a couple of tutorials set up on how to get it up and running in Dev-C++.
Rob Loach [Website] [Projects] [Contact]
SDL is prety darn simple. I have some tutorials that cover the API on my web site.
The link is in my sig.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
SDL was the first graphics API I learned , and I felt it was very easy to understand and work with. Go to www.libsdl.org and look at Marius's tutorial, It will tell you all you need to know to get started.
My Current Project Angels 22 (4E5)
Advertisement
i found sdl pretty simple, wish it had true type font support though. could never get SDL_Image working.

it does however have a function to eject the cd-rom drive which imiediltly gives it cool++;
| Member of UBAAG (Unban aftermath Association of Gamedev)
Quote: Original post by Cibressus
i found sdl pretty simple, wish it had true type font support though. could never get SDL_Image working.

it does however have a function to eject the cd-rom drive which imiediltly gives it cool++;


Why don't you try using the SDL_ttf extension library? That will give you true type font support. [smile]

Hero of Allacrost - A free, open-source 2D RPG in development.
Latest release June, 2015 - GameDev annoucement

I couldn't get the SDL_ttf extension to work :( But I hear it is good.
Hi, a while since I last looked at this thread...

Thank you all so much for the simply great help you've given me. But I do have one final question.

Is it okay to jump straight into SDL, or should I learn some serious ordinary C/C++ beforehand?

This topic is closed to new replies.

Advertisement