Clearing Buffers

Hello people. I am currently loading some bitmaps to a screen, then
updating the rectangles they are in. I would like to load them to the back
buffer, then swap buffers. This works with SDL_Flip() in all respects
except I cannot find a function to clear the back buffer before writing to
it. Is there one that does not have to do with Open GL?

‘Leo’_________________________________________________________________
Best Restaurant Giveaway Ever! Vote for your favorites for a chance to win
$1 million! http://local.msn.com/special/giveaway.asp

with this function you can free Surfaces:
SDL_FreeSurface(image);

I think this should help you. Afaik you can free the Surface of the back-buffer.

greets
Marc GerritzenOn Tue, 18 May 2004 10:28:13 -0400 “Leo Dioxide” wrote:

Hello people. I am currently loading some bitmaps to a screen, then
updating the rectangles they are in. I would like to load them to the back
buffer, then swap buffers. This works with SDL_Flip() in all respects
except I cannot find a function to clear the back buffer before writing to
it. Is there one that does not have to do with Open GL?

I guess you can, but then SDL will most likely crash next time you try
to touch the screen, or when you close it. Never free the display
surface!

As to the original question; there’s no “ClearSurface” call, but there
is SDL_FillRect(). This should do the trick:

SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));

(The last three numbers are R, G and B respectievly. Change these for
other colors than black.)

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Tuesday 18 May 2004 16.59, Marc Gerritzen wrote:

with this function you can free Surfaces:
SDL_FreeSurface(image);

I think this should help you. Afaik you can free the Surface of the
back-buffer.