OpenGl or SDL

Should I learn OpenGl or sdl which one is better for making games? I know they're both API's and I think opengl is more popular than sdl.. So which one should I learn for like 2d and 3d game programming? I know the basics of c++ and am ready to move on to make applications with GUI's. if you can, please try to give me a clear answer on what exactly i should learn. Thank you so, so much. Mw130
Bump plz? I wanna get started today.
It's much easier to create a 2D game using a library like SDL (SFML, being a C++ library would probably be a better choice) than using OpenGL directly. These libraries can also handle window creation, input and sound (in the case of SFML) for you, none of which are covered by the OpenGL API.

For 3D applications, you can also use the libraries to handle these tasks for you, but you'll still have to use OpenGL to do the actual rendering.

So the answer is "both".
Hi thanks so
Much for the answer. As to the windows creation reference, I was able to use only OpenGL and Glut to create a window. Can't I just use only openGl? It seems a lot more official and i like it better. Sdl and sfml are way too third party-y. I want to use OpenGl for everything, as it is much more official :3. Thanks so, so much! I still hope for more answers though
:p
Well, GLUT isn't directly part of OpenGL itself, so it's essentially also a "third-party" library. This expresses itself in the fact that neither Windows nor Linux distributions tend to come with an implementation of GLUT preinstalled (meaning freeglut, at least I don't know of any other implementations), so you'll also have to ship it with your application (or specify it as a dependency on Linux).

But if you feel comfortable doing things that way, then go ahead. You can still look for other options later.
But lile on xcode, GLUT doesnt need to be downloaded. Do a lot of people use OpenGL and Glut for games? I cant use directx because im on a mac. Is openGL directly part of c++? I want to program c++ without using anything third party. I just want to use graphics from c++ in a simple form and not have to use third parties. I think maybe if not ill move to java because i hear java has all of its api's already in it and you dont have to install third party franeworks and stuff.. All help is appreciated. Thanks
I want to program c++ without using anything third party.
This is not possible. C++ has no concept of "graphics". At the very least you'll have to communicate with the OS API and talk to the device drivers directly. Basically, you'll just end up doing all the work OpenGL would have done for you, only your program will cease to work if you move it to a different computer (even if you recompile it there), because there's a zillion different driver-hardware combinations. That's why OpenGL and DirectX exist. It's otherwise impossible to make a single program that works everywhere.

OpenGL development files (headers and import libraries) come by default with every compiler I've ever seen, save maybe for the really obscure ones, and runtime OpenGL files are bundled with device drivers for all modern (post 2000 if not earlier) graphics cards. So there's hardly any installation required.
Ok so would i be able to make a game that is just opengl and nothing else? Since you say opengl comes with every graphics card, i really like that, since it would make it really portable. So can i make a game like world of wArcraft or call of duty just by using opengl ? I really like opengl
But lile on xcode, GLUT doesnt need to be downloaded.

If so, that's a Mac speciality. It doesn't tend to come preinstalled elsewhere.

Is openGL directly part of c++?

It's not. However, it's an API which you can expect to find an implementation of on any OS/device supporting/having 3D hardware.

Do a lot of people use OpenGL and Glut for games?

I doubt any serious projects use GLUT, but other than DirectX on Windows, there's no real alternative to OpenGL if you want 3D graphics. So yes, a lot of people use it.

So can i make a game like world of wArcraft or call of duty just by using opengl ?

You can do the rendering part with OpenGL, yes. However, you'll still have to do window creation, sound, input etc. yourself, because that's not covered by OpenGL (nor the C++ standard library). And since these things work differently on Mac OS X, Windows and Linux, using a cross-platform library such as SDL or SFML saves you a lot of work if you want your game to work on all those platforms.

because i hear java has all of its api's already in it and you dont have to install third party franeworks and stuff.

Yes, Java comes with a lot of functionality, especially compared to the bare-bones C++ standard library, however you still need a library such as JOGL for OpenGL support.
Besides, the JRE is one huge third-party framework in itself.
Last edited on
Well, sort of. OpenGL is a Graphics Library, so it doesn't provide anything for things other than graphics. You can make a complete game using nothing but OpenGL, provided that:
1. You talk with the OS's window manager directly to allocate screen resources (creating windows to display your graphical output, or switching to fullscreen) and get user input.
2. You talk with the OS directly for audio output.
3. You roll your own audio, bitmap, and mesh formats (or you implement existing formats yourself).
If you don't mind reinventing the wheel and/or wasting your time in tangential subprojects, sure, you can do it.
But the problem i have with sfml and sdl is that i am scared that they will be like unsupported and unstable; i dont want to spend a lot of time learning sdl and sfml to later find them become unstable. Is there any really reliable way to do that window creating and everything?
There aren't many libraries that are better supported and more stable than SDL.

i dont want to spend a lot of time learning sdl and sfml to later find them become unstable

That's impossible, because learning how to use either doesn't require a lot of time in the first place.

Is there any really reliable way to do that window creating and everything?

You can do it yourself. If you're a perfect programmer, you'll think of every detail and every potential problem that could arise with every possible hardware/software combination on the user's machine, including all those which even the creators of SDL and SFML didn't manage to think of.
Last edited on
Athar, So I think the clear choice for me is SFML, right? SDL I tried but it is hard to install onto mac and I haven't heard of a lot of succesful things that happened with it. So let me review, and you guys just tell me if I'm right; i can use SFML, create a window with SFML, and when I created the window, thats when OpenGL comes in for graphics. I can also add audio from SFML... Is SFML easy and very stable? Will it be worthwhile to learn? or should I just go with Java? I really like c++ and know its great for programming, but I want to work on something that I know is stable. So again, should I do SFML(for windows) and then OpenGL for all the graphics part of it? Is that ok? Thanks guys
Yes its very easy to learn. Its a wrapper for graphics, networking, and input. It has the potential for advanced drawing that you may need. But the idea is that it allows for easy integration into a project so that you do not have to worry about the details. Later, if you want, you can add OpenGL calls to the pipeline, but in the beginning you do not have to.

Foe example, if you wanted to load a texture from a file and have a sprite display it the calls in SFML would be:

1
2
3
sf::Texture MyObject;
Object.loadFromFile("Filename");
sf::Sprite MySprite(Object);


HI! thanks for that. Would you know how I can install SFML into xcode? Do you know if like SFML will soon become a new standard for c++ api's? Thanks for replies!
closed account (D80DSL3A)
They have a tutorial for this. I assume you want version 2.0 (the latest version)
Here's a link to their tutorial for installing SFML with Xcode:
http://www.sfml-dev.org/tutorials/2.0/start-osx.php
Topic archived. No new replies allowed.