Sign in to follow this  
vanzukeus

sdl+sdlgfx VS sdl+opengl VS sdl only FOR 2D

Recommended Posts

Hi all, I'm writing a 2D turn based game with SDL. I'm writing it with SDL because this library seems the most portable library to create games. I'd like to write all the code with SDL only but there is a problem, it doesn't support neither the basic graphic functions like draw circle, ellipse... there is no way to resize or rotate the images. I'm using then sdl_gfx that supports those functions. The fact is, I don't have understood if this library supports the same OS of SDL. My goal is that this game works on a lot of OS and I don't know if the choice of using this sdlgfx is correct. I have heard about OpenGL, that it is more powerful because it makes the calculations in HW instead of SW. SDLgfx is good because it is very simple to use (the ttf stuff is great) but what do you suggest me? switch to OpenGL or not? I have saw that a lot of games use sdl+openGL.. sdl only or sdl+sdlgfx are not valid choices?

Share this post


Link to post
Share on other sites
I was in a similar position not so long ago. SDL was bogging down with busy 2D scenes and so I made the switch to OpenGL. The upgrade path is convenient and it doesn't take too long to switch, plus you can still use SDL surfaces with OpenGL textures. The advantages are greater than the cons and the switch was worthwhile (not to mention great performance). The only thing I didn't finish yet is font rendering.

With all that said, you probably won't be too concerned with performance if you're just writing a turn based game, you don't need to update the screen unless the scene has actually changed.

Share this post


Link to post
Share on other sites
If you need sprite rotation and scaling you pretty much need OpenGL. If not, stick with regular SDL. Like chapter78 said, if the performance turns out to be a problem there's a convenient upgrade path.

[Edited by - Windryder on March 16, 2010 10:26:06 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Windryder
If you need sprite rotation and scaling you pretty much need OpenGL. If not, stick with regular SDL. Like chapter78, if the performance turns out to be a problem there's a convenient upgrade path.


got it.. and, about the portability instead?

Share this post


Link to post
Share on other sites
Quote:
Original post by vanzukeus
Hi, thanks for the answer.
Yes, I guess too that performance in this sort of game isn't very important.
Question: font rendering with OpenGL is bad?


No, it is fine, I just didn't get round to implementing it yet :)

Share this post


Link to post
Share on other sites
Quote:
Original post by vanzukeus
got it.. and, about the portability instead?


Of SDL_gfx?

Quote:

The library compiles and is tested for a Linux target (gcc compiler) and a Win32 target (VisualC, xmingw32 cross-compiler) as well as BeOS and MacOS X PowerBuilder See README for VC and PowerBuilder compile information.


SDL itself probably the most portable graphics library you'll find.

Share this post


Link to post
Share on other sites
Quote:
Original post by chapter78
Quote:
Original post by vanzukeus
Hi, thanks for the answer.
Yes, I guess too that performance in this sort of game isn't very important.
Question: font rendering with OpenGL is bad?


No, it is fine, I just didn't get round to implementing it yet :)


Ah ok, fine :)

cool your project :D

Share this post


Link to post
Share on other sites
Quote:
Original post by Windryder
Quote:
Original post by vanzukeus
got it.. and, about the portability instead?


Of SDL_gfx?

Quote:

The library compiles and is tested for a Linux target (gcc compiler) and a Win32 target (VisualC, xmingw32 cross-compiler) as well as BeOS and MacOS X PowerBuilder See README for VC and PowerBuilder compile information.


SDL itself probably the most portable graphics library you'll find.


SDL is the most portable graphics library but.. it has only the fill_rectangle method..


For rotations and zoom I have found this lib: http://sdlbilinear.googlecode.com/files/SDL_Bilinear.zip

and this should work on all the OS supported by SDL.
SDL_TTF should work for font rendering but..
for the drawing basic primitives I have not found nothing more portable than sdl_gfx.. OpenGL is for win,linux,mac and IFAIK for other system exists OpenGL ES that is different from OpenGL..

It's very strange that doesn't exist a tiny library for basic drawing primitives that supports all the SDL OS :(




Share this post


Link to post
Share on other sites

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