Witch should I learn first: SDL or OpenGL? (C++)

Started by
8 comments, last by guywithknife 12 years, 3 months ago
Hello everyone, this is probably my first post on gamedev.net, I don't want to be annoying and I don't really know rules of where should I post my questions. But this is kind of important for me so here it goes.

My question is what should I learn first? SDL or OpenGL?

I'm almost finished reading C++ Primer Plus (Fifth edition) and I just ordered this (OpenGL game programming) book from amazon. And I'm going to order this one (Focus on SDL) soon. I ordered OpenGL book first because it was cheaper than Focus on SDL.

So now my concern is if I start reading OpenGL book first will I be able to integrate it with SDL easily? Or I should for SDL book, and learn OpenGL after that. Or maybe I don't really need SDL? Maybe that openGL book everything I need? You know, like key press detection and all that stuff.

I would be VERY thankful if yo guys could respond as clearly as you can. As I said earlier this is important to me.

Thanks
-Pufixas
“There are thousands and thousands of people out there leading lives of quiet, screaming desperation, where they work long, hard hours at jobs they hate to enable them to buy things they don't need to impress people they don't like.”? Nigel Marsh
Advertisement
If you are after input and audio as well, then concentrate on SDL. As, openGL focuses only on the graphics side of things.
I'd suggest not wasting any time on SDL. SDL is outdated, and lacking many features that SFML provides.

please, take a look at SFML before you dive in SDL, you'll be glad you did.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Huge thanks for everyone.
But you guys didn't answer my main question: Should I learn OpenGL or SDL, SFML first? Or there's no diference? Because my OpenGL book is arriving soon, and I don't know if I should start reading it now, or wait till I learn SDL or SFML?
“There are thousands and thousands of people out there leading lives of quiet, screaming desperation, where they work long, hard hours at jobs they hate to enable them to buy things they don't need to impress people they don't like.”? Nigel Marsh

Huge thanks for everyone.
But you guys didn't answer my main question: Should I learn OpenGL or SDL, SFML first? Or there's no diference? Because my OpenGL book is arriving soon, and I don't know if I should start reading it now, or wait till I learn SDL or SFML?


The APIs / Libraries aren't all that complex (You can learn the basics of SDL or SFML in 10 minutes and the online documentation is pretty much the only thing you need), The hard part is learning Game programming (which the book you linked covers) or 3D graphics in general (Something you will have to get a good grasp on if you wish to use OpenGL effectivly).

Once you've learned how to make games using one API you should be able to swap to a new one pretty quickly so if you get a game programming book i'd recommend going with whatever libraries they are using in that book.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

[quote name='Pufixas' timestamp='1325833397' post='4900243']
Huge thanks for everyone.
But you guys didn't answer my main question: Should I learn OpenGL or SDL, SFML first? Or there's no diference? Because my OpenGL book is arriving soon, and I don't know if I should start reading it now, or wait till I learn SDL or SFML?


The APIs / Libraries aren't all that complex (You can learn the basics of SDL or SFML in 10 minutes and the online documentation is pretty much the only thing you need), The hard part is learning Game programming (which the book you linked covers) or 3D graphics in general (Something you will have to get a good grasp on if you wish to use OpenGL effectivly).

Once you've learned how to make games using one API you should be able to swap to a new one pretty quickly so if you get a game programming book i'd recommend going with whatever libraries they are using in that book.
[/quote]

Thanks you! I have no more questions :)
“There are thousands and thousands of people out there leading lives of quiet, screaming desperation, where they work long, hard hours at jobs they hate to enable them to buy things they don't need to impress people they don't like.”? Nigel Marsh
Like already mentioned, be sure to check out SFML as well, I prefer SFML above SDL but it might be wise to check out both of them.
OpenGL is much harder to use than SFML, even a beginner in programming should be able to draw something on the screen with OpenGL but it will simply take more time and effort. An API like SFML is easy to use and contains functions and classes to easily open a window, draw some pictures, handle user input, play audio and much more. In the beginning I think you should just focus on programming some application or game and not on how to set up an API to do some basic drawing. My suggestion is to play around with SFML a little while. You won't need a book on the subject, just go to http://www.sfml-dev.org, download the 1.6 version and install (check out the tutorials if you don't know how to do this), than check out the tutorials on how to open a window and have some fun creating your first game. Also check out the documentation, where you have an overview of all classes.
I pretty much agree with everything that has been said.
However, I would very much suggest that if you are going to get SFML, that you grab the latest snapshot of 2.0 rather than the 1.6 version as a lot of stuff has been improved since the release of 1.6.
Also, while doing basic drawing and such with SFML doesn't really require much knowledge of what is actually being done through OpenGL, I would definitely say that learning about OpenGL first or while you learn SFML could be a great way to learn about interacting with the GPU at a pretty low level, and as far as I know, you are free to execute OpenGL calls in SFML if you would feel the need to for whatever reason.

You never specified what your main motivation to learn these things is, and I think that this should perhaps be the most important factor for your decision.
If you are genuinely interested in learning more about computer graphics, then I would suggest going with OpenGL or DirectX (depending on personal preference, just try both and see which one you like more), but if your main goal is to make a game (especially a 2D one) then I would definitely suggest going with SFML.

Have fun!
Also support the use of SFML, if I'm not mistaken it uses OpenGL as its backend.

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

 


I'd suggest not wasting any time on SDL. SDL is outdated, and lacking many features that SFML provides.

Not true. The latest version (SDL 1.3) is up to date. Check out the docs here. SDL 1.3 uses OpenGL for its rendering backend, supports multiple windows and so on.

SDL has fewer high level features than SFML does (SDL does have addon libraries for some of these features though). For example SFML has image loading built in, but in SDL you would usually use something like SDL_image. SFML does provide a lot more rendering primitives than SDL does (eg, shaders) - SDL definitely aims to be lightweight and low level (eg a thin layer to handle windowing and input while you use OpenGL directly).
SDL has a C API instead of an object oriented C++ API like SFML has. SDL supports more platforms. SFML has networking support built in, SDL does not (but again, theres an addon library for it). SDL 1.3 documentation is still very much a work in progress though, while SFML has solid documentation. Besides that, they are more or less equal.

If you go with the old SDL 1.2, it has a lot of documentation available too and is rock solid, but you lose out on a lot of features like hardware accelerated rendering (unless you manually use OpenGL) and multiple windows.

Having said all that, I would suggest using SFML since it will get you started quicker. SDL would be a good choice for someone who already knows what they are doing and want a base to build a custom engine on top of, but SFML would be, IMHO, a better choice to get started quickly and learn game programming since it provides many more high level features, but these may get in the way if you are trying to build a truly custom engine (which, unless you're an expert, you shouldn't be doing anyway).

This topic is closed to new replies.

Advertisement