Archived

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

Chocoboko

Blitting in SDL

Recommended Posts

Hello. I am trying to blit an image in SDL, yet before that, I am trying to blit an empty screen to erase the screen before blitting the image. It causes nasty flickering effects. My code is set up like this: *blit empty surface to erase screen* *blit image* *swap buffers* How do I do multiple blits in the same function without causing the screen to flicker? Or could it just be an outdated video card? I''d appreciate any answers you have. Thank you.

Share this post


Link to post
Share on other sites
I don''t know if I can help you because I don''t know much about SDL, but the following is the first thing that popped into my mind:

please tell me that this empty screen is being blitted to the offscreen surface. If you were to blit the empty screen to the buffer that is currently on the screen it would cause the flickering that you describe.

Share this post


Link to post
Share on other sites
quote:
Original post by baumep
Are you using double buffering?
Make sure to pass SDL_DOUBLEBUF to SDL_SetVideoMode.
Instead of blitting an empty surface you might try using SDL_Rect to clear the background.


Yea SDL_Rect is the common practice to clearing the screen (the primary surface) in order to redraw it and definetly better than blitting a whole surface.

Just a little addition to what baumep said... when you use the SDL_DOUBLEBUF flag, make sure you also use the SDL_HWSURFACE flag otherwise the double buffering won''t work.

_________________________________________________________________

Drew Sikora
A.K.A. Gaiiden

ICQ #: 70449988
AOLIM: DarkPylat

Blade Edge Software
Staff Member, GDNet
Public Relations, Game Institute

3-time Contributing author, Game Design Methods , Charles River Media
Online column - Design Corner at Pixelate

Unnoficial IGDA chat! [polaris.starchat.net -> #igda]
NJ IGDA Chapter - NJ developers unite!! [Chapter Home | Chapter Forum]

"Real programmers don''t work from 9 to 5. If any real programmers are around at 9am it''s because they were up all night."
-Anon.

"It''s not the size of the source that matters, it''s how you use it"
- Self

Share this post


Link to post
Share on other sites