[SDL] Flickering DX.
David Olofson
david at olofson.net
Mon Nov 5 11:10:42 PST 2007
On Monday 05 November 2007, Miguel Pragier wrote:
> When I use DirectX, my screen is flickering.
How? Directly or via SDL? If the latter, are you using SDL 1.2
(stable) or 1.3 (development)? (These have rather different video
subsystems.)
> Is it common?
Yes, it's perfectly normal if you're trying (and failing) to
perform "smart updates" (ie redraw only what's changed) over a double
buffered hardware surface.
The reason is that a double buffered hardware surface normally uses
two actual VRAM surfaces that are *flipped* by SDL_FlipSurface(). No
copying is done, so the new "drawing page" you get after a flip is
two frames old, rather than identical to the last drawing page.
Simple solution: Always redraw the whole screen. Basically, assume
that the drawing page is filled with random garbage after a flip.
If you want to do it the hard (but in some cases, very fast) way, you
can have a look at my Fixed Rate Pig example (pig-1.0), which (among
other things) demonstrates one way of performing smart updates, even
on true page flipped displays:
http://olofson.net/mixed.html
For starters, just verify that "Pig" actually works in with a double
buffered hardware surface. (Retrace sync'ed frame rate probably; no
flickering, no tearing.)
> I know my videoBoard support the DX I'm using.
I don't think you would be able to set up a display at all if it
wasn't.
//David Olofson - Programmer, Composer, Open Source Advocate
.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
'-- http://www.reologica.se - Rheology instrumentation --'
More information about the SDL
mailing list