How to clear the SDL screen

Hi All,

I have written a SDL application which creates YUV overlay using
lay=SDL_CreateYUVOverlay((int)rect.w,rect.h,SDL_YV12_OVERLAY,sdl_screen) and
I am writing YUV data continuosly and updating using
SDL_DisplayYUVOverlay(lay,&rect);

but last frame is freezing on the screen after completion of writing the YUV
data. i want to clear the screen for that purpose i have written as
mentioned below.

SDL_FillRect(sdl_screen,NULL, 0x000000);
SDL_Flip(sdl_screen);

even though it is not clearing the screen if i called above two statements
twice it is clearing 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.

Can any one help me on this issue or suggest me how can I clear the screen .

Thanks

Hi, have you tried to fill a new created surface and blit that to your sdl_screen? You may also try calling SDL_UpdateRect._____

Von: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] Im Auftrag von anil v
Gesendet: Mittwoch, 31. M?rz 2010 07:02
An: sdl at lists.libsdl.org
Betreff: [SDL] How to clear the SDL screen

Hi All,

I have written a SDL application which creates YUV overlay using lay=SDL_CreateYUVOverlay((int)rect.w,rect.h,SDL_YV12_OVERLAY,sdl_screen) and I am writing YUV data continuosly and updating using SDL_DisplayYUVOverlay(lay,&rect);

but last frame is freezing on the screen after completion of writing the YUV data. i want to clear the screen for that purpose i have written as mentioned below.

SDL_FillRect(sdl_screen,NULL, 0x000000);
SDL_Flip(sdl_screen);

even though it is not clearing the screen if i called above two statements twice it is clearing 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.

Can any one help me on this issue or suggest me how can I clear the screen .

Thanks

[…]

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.On Wednesday 31 March 2010, at 07.01.42, anil v <anil.vemulapally at gmail.com> wrote:


//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 |
’---------------------------------------------------------------------’