SDL hardware bliting.

Started by
3 comments, last by rip-off 16 years, 4 months ago
Hi, I have wrote a 2d engine using SDL. I am trying to understand how SDL decide which type of blitting to use. It seems I just can't using hardware blitting while in window mode. is this valid ? Any help in understanding how to benefit from hardware accelartion will be appreciated. Thanks, Nuno1
Advertisement
Bob Pendleton has a series of articles on SDL which you may find interesting.

From what I know, you will only get acceleration using the DirectDraw backend of SDL on Windows (recent SDL builds default to the GDI backend) in fullscreen mode. On Linux, hardware acceleration *appears* to be root only, at least under X.

In many cases, using OpenGL can be a lot faster than using SDL.
I've found that software rendering with SDL is usually faster than hardware rendering with it. There are a few reasons for this. Most computers nowadays have ample ram and processing power for pretty much any 2D game, most graphics cards are not designed to do blitting fast, and hardware alpha blending is especially slow.

Are you having performance problems in software mode?
Well,
doing simple drawing on a framerate of 33 FPS cause my CPU (3gig Dual core) to spike. debugging SDL a little bit and I found out it decide to draw my spirtes pixel by pixel.

I was positive I am doing somthing wrong, but I get the feeling that it just how it works.

Nuno1
If you are doing alpha blending, then SDL will draw pixel by pixel.

If you are using an alpha channel, but only with alpha values of exactly transparent and opaque, consider using colour keying instead.

If you depend on lots of alpha blending for your game, I recommend switching from SDL to something like OpenGL, which can hardware accelerate it.

I'm afraid without more information we can but guess.

This topic is closed to new replies.

Advertisement