[SDL] Flickering and division by zero in Windows
Andre de Leiradella
leiradella at bigfoot.com
Tue Feb 27 17:58:34 PST 2007
>> >> >> I'm writing an SDL application but am having trouble with
flickering.
>> >> >> I tried all combinations of flags (SDL_SWSURFACE, SDL_HWSURFACE,
>> >> >> SDL_DOUBLEBUF, SDL_NOFRAME, SDL_FULLSCREEN etc.) but with no luck.
>> >> >>
>> >> What about this one, any thoughts?
>> Is it possible that you're drawing to one buffer and SDL_gfx is drawing
>> to the other? Try removing SDL_DOUBLEBUF and see if it makes a
difference.
I thought SDL handled the two buffers itself, exposing only one of them
at a time to the host program. My program does the following:
1) blit the entire background on to the screen (SDL_BlitSurface)
2) draw the transparent rectangle on the screen covering a part of it
(SDL_gfx's boxColor)
3) SDL_Flip or SDL_UpdateRect
4) Do it all again
I tried pretty much all combinations of SDL_SWSURFACE, SDL_HWSURFACE,
SDL_DOUBLEBUF, SDL_NOFRAME and SDL_FULLSCREEN, all with SDL_UpdateRect
and SDL_Flip. It flickered badly on all of them... :-(
>> Also, if you need to touch pixels directly, SDL_HWSURFACE is probably
>> going to slow you down...that's meant to be a speed boost if you're
just
>> doing SDL_FillRect() and SDL_BlitSurface() and the hardware supports
it,
>> but if you have to access the framebuffer directly (like SDL_gfx
>> probably does), you're probably taking a speed hit here as it has to
>> keep locking and unlocking the surface.
Yup, I'm aware of those. I only tried SDL_HWSURFACE to see if the
flickering would go away.
Thanks for the tips, though. Could you just elaborate on "...you're
drawing to one buffer and SDL_gfx is drawing to the other"? Maybe I have
missed something while setting up the video mode...
Thanks again ryan,
André
More information about the SDL
mailing list