Sign in to follow this  

SDL or OpenGL?

This topic is 3625 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

I have almost finished the design of my first true game and I need to know whether SDL will be powerful and flexible enough to handle it or if i should learn OpenGL. Here's the details: I want to make a top view shooter where the player's character always faces the mouse location and moves around using WSAD, you fight with the computer (and eventually other players) using about 3 different types of guns (to start with) in around 5 different maps (again, to start with). You click to shoot and you can pick up ammo and other guns. It will be slightly 3D as you can go up ramps and down into ditches, however you cannot shoot players on different heights than you. EDIT: I am using c++ as the language.

Share this post


Link to post
Share on other sites
With SDL the only tricky part is rotation. SDL doesn't do this because software rotation is relatively slow. That said you can create precomputed rotation images.

However, if you haven't started yet I would recommend going with OpenGL. It isn't especially difficult. You may not even need to use raw OpenGL at all if you use a layer on top. I tried hxRender quite a while ago, IIRC it contains what you need.

The other advantage of OpenGL is that it opens the door for hardware accelerated alpha blending. SDL can do alpha blending, but even modest amounts of it will have a noticeable affect on your framerate.

The downside of OpenGL is that some older or cheaper computers (typically ones with integrated graphics cards) can be quite slow. My asteroids game uses OpenGL: running it on some of the computers in my college reveals them to have a frighteningly small matrix stack, in addition to being generally slow to render. This could be a concern for you.

Share this post


Link to post
Share on other sites
I would go with OpenGL. I've mostly used (Managed-)DirectX in the past, and recently started to learn OpenGL(That's what we use at work), and I was quite surprised how easy OpenGL is to learn.

Quote:
Original post by rip-off
The downside of OpenGL is that some older or cheaper computers (typically ones with integrated graphics cards) can be quite slow. My asteroids game uses OpenGL: running it on some of the computers in my college reveals them to have a frighteningly small matrix stack, in addition to being generally slow to render. This could be a concern for you.


That problem is still a problem on computers where you would use SDL / DirectX instead of OpenGL. If the videocard lacks, it's likely you will run into slow downs. I'm not sure how OpenGL acts when the hardware doesn't support a certain feature, but I assume it will revert to software mode.

In those cases, it's up the to developer to either say: You need a better to run this, or provide optimized code that overcomes the lack of that by, for instance, pre-calculating rotation angles.

Share this post


Link to post
Share on other sites
Why not use both? I would use SDL for handling the creation of the window aswell as events such as key presses or mouse move and use OpenGL for the hardware rendering.

Share this post


Link to post
Share on other sites
Quote:
Original post by cNoob
Why not use both? I would use SDL for handling the creation of the window aswell as events such as key presses or mouse move and use OpenGL for the hardware rendering.


I agree. My initial post only dealt with choosing between rendering with SDL and OpenGL. I heartily recommend keeping SDL for everything else regardless of which rendering option you choose.

Share this post


Link to post
Share on other sites
It seems as though I have chosen a game too hard for my first, that, and the fact that I don't have the time to learn 2 different game libraries.

I think I might start with something easier that I can use SDL to create and leave
this design until my 2nd or 3rd game.

Share this post


Link to post
Share on other sites

This topic is 3625 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this