SDL Question

Started by
7 comments, last by evillive2 18 years, 1 month ago
Hi guys... Here's my doubt: When i call SDL blit functions...does SDL use some OpenGL function routines for doing blitting?... So...if i use OpenGL for blitting, instead of SDL i will improve perfomance?. Thx. Bye
Advertisement
SDL does not use OpenGL for blitting. Under windows, it uses direct draw.
If you use OpenGL, you will get a performace boost if you are doing stuff like rotation and scaling.
So if i want to make a full detailed scene with lots of effects...y shall use OpenGL to gain perfomance?

thx
Bye
It basically breaks down like this.

SDL - simple, easy pixel manipulation, easy colorkey, good at low bits per pixel and resolution

OpenGL (with good graphics card) - fast at high resolutions, much faster for transformations, can enable vsync, blending options

SDL is very good if you want to build a retro game with not much rotation and scaling, and 800x600 with 16bpp or less.
You can easily do 32bpp in SDL, boder. I do.
You can, but unlike with Direct3D or OpenGL, where you often see a speed increase if you move from 16bpp to 32bpp, in SDL it is not unusual to see very noticeable decreases in speed when doubling the bits per pixel. Whether or not the increase in quality is worth it to you is a matter of preference.

Also if you use indexed color modes, SDL is a good choice. Probably a better one than OGL/D3D.
If you want SDL to use OpenGL when blitting, with all the advantages when using transparency and high resolution, you might give glsdl a try. It's quite easy to setup and you don't have to rewrite your SDL related code or implement blitting on your own.
baumep
Quote:Original post by baumep
If you want SDL to use OpenGL when blitting, with all the advantages when using transparency and high resolution, you might give glsdl a try. It's quite easy to setup and you don't have to rewrite your SDL related code or implement blitting on your own.


In the same spirit, you might want to take a look at hxrender. I have not used it myself so I cannot comment on it or recommend it, but it seems to be an easy and lightweight library to use OpenGL rendering with SDL.
If you are used to using SDL then glsdl is great. You can finally use the destination rectangle in SDL_BlitSurface to scale an object and as long as you have decent OpenGL drivers you will see a nice performance boost when using alpha. I never really looked for rotation and am unsure if/how it supports that but with the scaling and alpha support why not give it a shot? If all else fails you can always look at the code and figure out what they did, it is after all freely available to look at and use.

If you are a little more familiar with some 3d terminology then I would highly recommend hxRender. It isn't really for the complete 3d newbie but the learning curve is pretty low with it compared to using SDL and OpenGL without any help from a 3rd party library. The best part about hxRender (IMHO) is that it is relatively small and isn't very complicated under the hood.

Lastly but definitely not least I also recommend using irrlicht if you have the time. It has some great 2d capabilities using OpenGL or D3D under the hood and it comes with built in GUI support. As with anything of this size, there is a bit of a learning curve but there is no reason that with a few days playing with it that you couldn't do anything you can do in SDL and more than likely much more. There is a great community and really offers quite a bit of flexibility.

Evillive2

This topic is closed to new replies.

Advertisement