Archived

This topic is now archived and is closed to further replies.

lubic

How do you do fast blitting using SDL ?

Recommended Posts

Hi I need to know how you do fast blitting using SDL. And if someone know how fast you can blit a fullscreen blit in 640x480x32, like a background pic or something. I am using a 200 mmx computer with 64 mb ram and 8 mb gfx memory. // lubic Edited by - lubic on January 16, 2002 2:07:02 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
As it happens, i was just playing arround with different setting to figure this out for myself. I used the second cone tutorial (well i modified this quite a lot), which was originally hardware blitting with double buffering. I recommend playing arround with these setting yourself because they depend partly on what you want to blit.
In my case there was no speed change when i changed to software blitting. However when i decided to only update the part of the screen where things have changed the speed went up quit a lot.
This you do with SDL_UpdateRects (with the s at the and) like

SDL_UpdateRects(screen,3,&rectangles)

where screen is the surface, 3 is the number of rectangles where things have changed and rectangles points to an array of pointer to the SDL_Rects specifying the 3 rectangles.

One imporatant thing to remember is that you should first do all your blitting and keep track of where things have changed, and then call UpdateRects only once. After that you can start blitting for you next frame.

If you are programming is a side scroller or something in which
most parts of the screen will change, forget about what i said, then you should update you total screen every frame.

Oh, and another tip.....if you load a 16 bpp bitmap into a surface and blitt this to you 32 bpp screen, then every time you blit, this has to be converted. So just after loading your bitmap you map it to a 32 bpp surface, so that you dont have to convert this during blitting....



Share this post


Link to post
Share on other sites
If you change from SW to HW you need to use fullscreen (I think) to get and speed changes.

I am makning a type of sidescroller so I need to update the total screen.

// Lubic

Share this post


Link to post
Share on other sites