Jump to content
  • Advertisement
Sign in to follow this  
Pufixas

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

This topic is 2525 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

[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 :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

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).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!