[SDL] How to clear the SDL screen
David Olofson
david at olofson.net
Wed Mar 31 06:41:12 PDT 2010
On Wednesday 31 March 2010, at 07.01.42, anil v <anil.vemulapally at gmail.com>
wrote:
[...]
> SDL_FillRect(sdl_screen,NULL, 0x000000);
> SDL_Flip(sdl_screen);
That seems ok, although theoretically, you can't be totally sure that 0x000000
means "black" on all displays. You should use SDL_MapRGB() for that,
especially if you want any other color than black.
> even though it is not clearing the screen if i called above two statements
> twice it is clearing
That's normal for a double buffered display.
> but it is getting crashing while Clearing the screen
> only. If i comment above code is working fine but Screen is not clearing
> when i stop the YUV data writing.
That sounds like the YUV code damages some structures or something...
Do you have access to Valgrind (Linux, Mac OS X, Un*x variants), BoundsChecker
(Windows) or something similar? Such tools can sometimes help find this kind
of bugs in a matter of minutes.
--
//David Olofson - Developer, Artist, Open Source Advocate
.--- Games, examples, libraries, scripting, sound, music, graphics ---.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
'---------------------------------------------------------------------'
More information about the SDL
mailing list