[SDL] How to implement double buffering?
Alex Barry
alex.barry at gmail.com
Mon Feb 13 05:36:35 PST 2006
the flickering is probably because either you are trying to draw
things too fast or your resolution is too high.
A better bet than vsync is just using a delay...
SDL_Flip( yourscreen );
SDL_Delay( 100 );
What resolution are you running? if it is very high, as you
mentioned, using SDL_UpdateRect or SDL_UpdateRects should work ok, but
then i suggest going OOP
Alex~
On 2/13/06, fari mueller <farimueller at yahoo.de> wrote:
> I want to get rid of the tearing effects I have when
> using E-UAE (Amiga emulator) on my arcade monitor.
> Hence I'm trying to implement VSync in E-UAEs SDL
> graphic routines like it was done for XMAME in the
> patch linked below.
>
> http://www.mail-archive.com/xmame@toybox.twisted.org.uk/msg06159.html
>
> Alas, I'm not familiar with SDl programming and I my
> attempts to do it just in the above linked example
> were not successful. What I did is the following:
> I set the flags SDL_DOUBLEBUF and SDL_HWSURFACE before
> invoking SDL_SetVideoMode. Furthermore I replaced all
> SDL_UpdateRect commands by SDL_Flip and set the
> environment variable SDL_videodriver to dga. With
> these changes I get an OK looking fullscreen picture
> as long as nothing moves, but if something starts to
> move the lowest 20% of the screen start to flicker
> white and the whole stuff slows down dramatically.
> May be the reason is that the original command
> SDL_UpdateRect (prSDLScreen, 0, first_line,
> current_width, last_line - first_line + 1);
> updates only a part of the screen, since I have the
> impression that exacly the part below the updated rect
> is flickering. However, I have replaced this command
> by
> SDL_Flip(prSDLScreen);
> which does not work. So my question is how to do it
> properly, do I have to update the rect by a blit
> command before flipping or how can I do it?
>
> Thank you in advance
>
>
>
>
>
>
>
> ___________________________________________________________
> Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>
--
Smith: "...Why, Mr Anderson, Why - Do - You - Persist?"
Neo: "Because I choose to."
-Matrix Revolutions
More information about the SDL
mailing list