SDL or DirectX for beginner?

Started by
19 comments, last by KindFred 19 years, 4 months ago
I have started learning C++ with the goal of making games, obviously :-) I have done one and a half games (One I didnt finish) in console box, but really now should be the time I start learning a little about graphics and looking ahead into which graphics library I will master. A couple days ago I showed off my tic tac toe game on the forums and someone mentioned that I should write it using the SDL library, so since then I have been fiddling with a little SDL, drew some graphics for a mario type platform game, and have been reading on how to calculate velocity and gravity (etc...) of objects, which I found to be very interesting and easy to understand. On the other hand, at work I have access to a huuge online library of books and have been browsing through some of the DirectX pages to (hopefully) get a bit of a feel for it. Same applies for OpenGL btw. So I know SDL is easier and rather quick to get into and get something onto the screen and handles events for you (Which I love! :-D). And DirectX is platform specific btu feature rich, and 3D, same with OpenGL, but Former is M$ only and latter is Cross Platform and a tad easier. Now, my question (yep, I babble a little, sorry): Is it worthwhile mastering SDL now and learning DirectX/OpenGL later? Or should I trudge through DirectX/OpenGL now and lose my hair at a young age?
__________Michael Dawson"IRC is just multiplayer notepad." - Reverend
Advertisement
well first you have to understand that if you are programming in 2D these are your choices: DirectDraw (DX 7.0), Direct3D (DX 8.0-9.0c), OpenGL, SDL, Allegro. for ease of use and the fact that it's being updated i'd use Allegro.

now for 3D graphics, you'll have no choice but OpenGL or Direct3D. you can integrate them with SDL or Allegro but you'll need to use OGL or D3D ir you want any 3D capabiliities.

Beginner in Game Development?  Read here. And read here.

 

my recommendation is that you learn SDL or Allegro, then later combine them with OGL(it can be done, but with Allegro you need to use AllegroGL, plain SDL works with OGL though). SDL/Allegro+OpenGL has all the features of DirectX, and it's (IMHO) easier to learn/use and it's crossplatform
Quote:Original post by Alpha_ProgDes
well first you have to understand that if you are programming in 2D these are your choices: DirectDraw (DX 7.0), Direct3D (DX 8.0-9.0c), OpenGL, SDL, Allegro. for ease of use and the fact that it's being updated i'd use Allegro.

now for 3D graphics, you'll have no choice but OpenGL or Direct3D. you can integrate them with SDL or Allegro but you'll need to use OGL or D3D ir you want any 3D capabiliities.


Is it common (or recommended) to go into 2D then 3D, or to start with basic 3D and move into more complex 3D? I think I'm going into 3D ;-) IMHO I dont think 2D will take you very far nowdays.
__________Michael Dawson"IRC is just multiplayer notepad." - Reverend
Quote:Original post by Roboguy
my recommendation is that you learn SDL or Allegro, then later combine them with OGL(it can be done, but with Allegro you need to use AllegroGL, plain SDL works with OGL though). SDL/Allegro+OpenGL has all the features of DirectX, and it's (IMHO) easier to learn/use and it's crossplatform


I have seen that SDL has some OGL elements but have never known exactly why/how. Is the OGL in SDL capable of any 3D?
__________Michael Dawson"IRC is just multiplayer notepad." - Reverend
Learn both OGL and D3D and if you can learn them at the same time do that.

Allegro and SDL simply tries to do too much for you and you need to trust it unless you want to look inside the ever growing backend of these wrappers.

Personally I do not like wrappers. They introduce a level of code which bloats your programs. Remember that OGL and D3D already serves to insulate you from the graphics card already. Having another layer of Allegro or SDL on top of that makes you all the more "not in direct control" of your hardware.
The GL commands you see in SDL are simply replacements for actions you would normally perform yourself when setting up opengl, but since sdl sets up your windows & does all the dirty os calls, it makes sense to have sdl handle those aswell.
To use opengl with sdl you have to link to opengl as well in your application, then you just use the standard gl commands to produce whatever you want once sdl has set it up for you. those sdl gl commands you see are just for initializing it

///
Edit: In response to the last. Not everyone wants control. I am a control freak, I can't even stand to use std anymore & atm am writing my own compiler. But this is all very extreme. Some people just want to make games. & for that sdl is a very quick reliable way of doing that & takes alot of weight off of your shoulders. I don't really recommend learning d3d @ the same time. Prehaps later when you've got a grasp of gl & have moved forward with games etc it might be worth just to get a fuller view on how to put a 3d engine together, but for practicality sdl & opengl are a lovely match
///
_______________________________ ________ _____ ___ __ _`By offloading cognitive load to the computer, programmers are able to design more elegant systems' - Unununium OS regarding Python
Firstly I wouldn't worry too much about it :P Really the best thing you can do to learn programming is to practise, so go with whatever you think will hold you interest. I personally love useing SDL for my window setup and then OpenGL for the 3D stuff - its extremely easy, its cross platform and SDL is an industry quality lib (some of the UT games linux ports were build with it, as well as some others). To use OpenGL with SDL I think its just one flag you have to pass into SDL_Init() and you away - too easy :D

2D stuff is a good place to start and learn the basics of events, input and game logic befor having to deal with the complicated stuff that 3D games bring. If you start with SDL for the 2D stuff its very easy to switch over to 3D stuff when your ready. But again if you like the look of DX or something else go with that - I just personally like the way SDL sets things out and I think OpenGL has a more intuitive set of calls than DX but feel free to pick something else!


Quote:Original post by xyuri
I have seen that SDL has some OGL elements but have never known exactly why/how. Is the OGL in SDL capable of any 3D?


Yes! Once you have the right window setup with SDL you can use OpenGL commands normally just like if you'd setup the window yourself - the advantage of having SDL do it is that its (a) cross platform and (b) much simpler than doing it with straing Win32 calls. I personally use none of the SDL graphics features I only use plain OpenGL for rendering, but SDL helps with the window setup and events.
Thank you very much for your advice guys :-) I find this BBS to have very helpfull and cheerfull members.

I think I'll get comfortable with SDL at the moment, because I'm a little established with it already and am still learning the C++ language itself (Still got miles to go).

Thank you :-)
__________Michael Dawson"IRC is just multiplayer notepad." - Reverend
Quote:Original post by xyuri
Quote:Original post by Alpha_ProgDes
well first you have to understand that if you are programming in 2D these are your choices: DirectDraw (DX 7.0), Direct3D (DX 8.0-9.0c), OpenGL, SDL, Allegro. for ease of use and the fact that it's being updated i'd use Allegro.

now for 3D graphics, you'll have no choice but OpenGL or Direct3D. you can integrate them with SDL or Allegro but you'll need to use OGL or D3D ir you want any 3D capabiliities.


Is it common (or recommended) to go into 2D then 3D, or to start with basic 3D and move into more complex 3D? I think I'm going into 3D ;-) IMHO I dont think 2D will take you very far nowdays.

it all depends on what market you're targeting. for instance, mobile games and handheld use alot 2D graphics. though we are now getting into the era of mini-3D games (Metroid Hunters and half of the PSP games), 2D still has its place. sometimes you have to justify whether a game needs 3D graphics before you using. but that's just me. [happy]

Beginner in Game Development?  Read here. And read here.

 

This topic is closed to new replies.

Advertisement