API - SDL or OpenGL?

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Bullet Pulse
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 89
Joined: Sun Feb 21, 2010 6:25 pm

API - SDL or OpenGL?

Post by Bullet Pulse »

Hi, I've recently finished a book on C++, and I feel that it's time to gain knowledge in an API. I am a pretty hardcore programmer, so it's not like I'm just doing it as a hobby, but more like whenever I have time to. So obviously, I'm looking for the better API to learn. Yes, I have looked at the specifications of the APIs, but I want to know others' opinions on the subject, specifically those who have some experience with both APIs.
Image
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Re: API - SDL or OpenGL?

Post by davidthefat »

Bullet Pulse wrote:Hi, I've recently finished a book on C++, and I feel that it's time to gain knowledge in an API. I am a pretty hardcore programmer, so it's not like I'm just doing it as a hobby, but more like whenever I have time to. So obviously, I'm looking for the better API to learn. Yes, I have looked at the specifications of the APIs, but I want to know others' opinions on the subject, specifically those who have some experience with both APIs.
both, try OpenGL on rendering and SDL with all the other stuff that opengl cant do
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: API - SDL or OpenGL?

Post by K-Bal »

I recommend to use SFML. You will gain the benefits of OpenGL with a nice and easy OOP interface, plus you can still use OpenGL directly. Also you get all the Network, Audio and Windowing stuff on top.
Busy_V
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 28
Joined: Mon Jan 04, 2010 5:29 am
Programming Language of Choice: C/C++

Re: API - SDL or OpenGL?

Post by Busy_V »

Before jumping into OpenGL I would recommend you to learn SDL first. Why? OpenGL is, or so I think, a lot harder to learn than SDL. Thus, it is also a lot more powerful than SDL. So, I would suggest you to learn first SDL and then continue with OpenGL. You don't just jump into the game development, you need to have patience to learn all the things, from ground up.

Some links that you may find useful (or not):

SFML

Guides & resources
RyanPridgeon wrote:If you wanna go there, you go for it man. Nobody is stopping you so just work hard and achieve your goals.
User avatar
Lord Pingas
Chaos Rift Regular
Chaos Rift Regular
Posts: 178
Joined: Thu Dec 31, 2009 9:33 am
Favorite Gaming Platforms: NES, SNES, Nintendo 64, Dreamcast, Wii
Programming Language of Choice: C++
Location: Hiding In My Mum's Basement With My Pokemon Cards

Re: API - SDL or OpenGL?

Post by Lord Pingas »

Learn SDL first then use OpenGL's rendering with SDL as you get more advanced in 2D games.

SDL is great for beginners in game development, and has quite a good amount of tutorials dedicated to it, like Lazyfoo.

When you want to move into 3d use OpenGL and GLUT.

GLUT handles windowing, input, and all the other stuff OpenGL can't do. I'm not to sure if GLUT has a sound library though.
User avatar
TheBuzzSaw
Chaos Rift Junior
Chaos Rift Junior
Posts: 310
Joined: Wed Dec 02, 2009 3:55 pm
Current Project: Paroxysm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: API - SDL or OpenGL?

Post by TheBuzzSaw »

OpenGL and SDL are not mutually exclusive of one another. SDL is a windowing API that handles device input, timers, threads, system signals, etc. OpenGL is nothing more than a 3D graphics API.

When using SDL, you have two choices for rendering. You can either use SDL's built-in 2D rendering system (all based on OpenGL anyway, though it supposedly can use DirectX's system too), or you can open a 3D rendering context and hand all control over to OpenGL itself.

SDL is a great choice in that it provides all the tools you need to build cross-platform games. The SDL_image module will load virtually any image format (great for loading textures in 3D). The SDL_ttf module will convert text to graphics. The SDL_net module will enable network communications. The SDL_mixer module will give you sound.

If you are going to make a really simple and straightforward 2D game, stick with SDL's basic 2D rendering model (surface blitting). If you want to make a 2D game more along the line of Elysian Shadows (complete with zoom, rotation, etc.), use OpenGL.

Either way, use SDL as your base. It is a solid library.
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: API - SDL or OpenGL?

Post by eatcomics »

TheBuzzSaw wrote:OpenGL and SDL are not mutually exclusive of one another. SDL is a windowing API that handles device input, timers, threads, system signals, etc. OpenGL is nothing more than a 3D graphics API.

When using SDL, you have two choices for rendering. You can either use SDL's built-in 2D rendering system (all based on OpenGL anyway, though it supposedly can use DirectX's system too), or you can open a 3D rendering context and hand all control over to OpenGL itself.

SDL is a great choice in that it provides all the tools you need to build cross-platform games. The SDL_image module will load virtually any image format (great for loading textures in 3D). The SDL_ttf module will convert text to graphics. The SDL_net module will enable network communications. The SDL_mixer module will give you sound.

If you are going to make a really simple and straightforward 2D game, stick with SDL's basic 2D rendering model (surface blitting). If you want to make a 2D game more along the line of Elysian Shadows (complete with zoom, rotation, etc.), use OpenGL.

Either way, use SDL as your base. It is a solid library.
I've been meaning to ask, would anyone be able to tell me whether I'd be better off with SDL for networking and sound and input, or SFML?

I've been trying to decide for a few days now, and this is the perfect place to ask I would imagine... Because Bullet Pulse might also be interested in this question :D
Image
User avatar
TheBuzzSaw
Chaos Rift Junior
Chaos Rift Junior
Posts: 310
Joined: Wed Dec 02, 2009 3:55 pm
Current Project: Paroxysm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: API - SDL or OpenGL?

Post by TheBuzzSaw »

My needs are generally very simple, so I just stick with all SDL components. SDL_net is a separate module, so it is harmless to use a different networking API.

As for the input, I do not recommend mixing APIs unless you have some tutorial explaining how to do so. Having SDL run the window but not manage input... I'm not sure if that's even possible, but Google may know otherwise.

I've heard of others using OpenAL instead SDL_mixer and using Boost threads instead of SDL threads.
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: API - SDL or OpenGL?

Post by eatcomics »

TheBuzzSaw wrote:My needs are generally very simple, so I just stick with all SDL components. SDL_net is a separate module, so it is harmless to use a different networking API.

As for the input, I do not recommend mixing APIs unless you have some tutorial explaining how to do so. Having SDL run the window but not manage input... I'm not sure if that's even possible, but Google may know otherwise.

I've heard of others using OpenAL instead SDL_mixer and using Boost threads instead of SDL threads.
That wasn't directed at me was it? I'm not talking about mixing APIs, just whether I should use OGL with SDL, or OGL with SFML...
Image
Post Reply