Double buffer

For use double buffer, is sufficient insert the SDLDOUBLEBUF flag?
tnx

— NighTiger wrote:

For use double buffer, is sufficient insert the
SDLDOUBLEBUF flag?
tnx

It’s been my experience in some versions of SDL that
software double buffering is not always possible, and
under Linux, you cannot always get hardware rendering
unless you are root.

Make sure you use SDL_VideoModeOK before assuming that
you can use double buffering. In my experience, SDL
will sometimes initialize even if it could not get
double buffering.

Anyone who cares to make any corrections to what I’m
saying, please be my guest, my memories of SDL
programming seem to melt together with Pygame
programming sometimes :(>


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/

— NighTiger wrote:

For use double buffer, is sufficient insert the
SDLDOUBLEBUF flag?
tnx

It’s been my experience in some versions of SDL that
software double buffering is not always possible, and
under Linux, you cannot always get hardware rendering
unless you are root.

On the contrary, it’s always possible to get s/w double buffering.
(That is, a set up with a single video buffer and a single s/w shadow
buffer.) That’s what you get when double buffering with h/w page
flipping is not available.

BTW, SDL_DOUBLEBUF implies (and works only with) h/w surfaces - and
SDL_SWSURFACE is #defined to 0, so you’re effectively asking for
that, and being ignored when you say just SDL_DOUBLEBUF.

Make sure you use SDL_VideoModeOK before assuming that
you can use double buffering.

Good idea, but it’s usually no big deal if you don’t get h/w page
flipping. It’s quite hard to hack code that totally fails because you
get a shadow + single setup. (The other way around is rather easy,
though…)

Never require a h/w display surface, because that’ll make your code
impossible to run on many systems, for no good reason!

For optimal performance, you should check whether you get a s/w or h/w
display surface, what kind of blits are accelerated etc, and adapt as
needed.

However, just asking for a double buffered display and then don’t give
a damn what you actually get will work reasonably well everywhere,
unless you’re doing heavy alpha blending.

In my experience, SDL
will sometimes initialize even if it could not get
double buffering.

Well, SDL will always initialize either way, since it’s always
possible to get a double buffered display. You get a h/w page flipped
display if possible, otherwise you get a single h/w surface + a s/w
shadow surface.

Now, getting an actual single buffered surface is pretty hard OTOH.
It should be possible on targets that support double buffering with
h/w page flipping, and it’s also possible with some OpenGL drivers
that have the (rather useless) capability of clipping and rendering
directly into windows and stuff. (The ATI drivers for Linux do that,
at least. There are probably others.)

Anyway, true single buffering is really rather useless, so who
cares? :slight_smile:

Anyone who cares to make any corrections to what I’m
saying, please be my guest, my memories of SDL
programming seem to melt together with Pygame
programming sometimes :frowning:

Doesn’t this apply to pygame as well? (Most of it has to, as it’s just
the way SDL works; raw or wrapped…)

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Tuesday 18 May 2004 16.43, Donny Viszneki wrote:

— David Olofson wrote:

On the contrary, it’s always possible to get s/w
double buffering.
(That is, a set up with a single video buffer and a
single s/w shadow
buffer.) That’s what you get when double buffering
with h/w page
flipping is not available.

Anyone who cares to make any corrections to what
I’m
saying, please be my guest, my memories of SDL
programming seem to melt together with Pygame
programming sometimes :frowning:

Doesn’t this apply to pygame as well? (Most of it
has to, as it’s just
the way SDL works; raw or wrapped…)

I’m told that Pygame does do a little more than you
asked for, and does not merely wrap SDL. Though
perhaps my experience getting no sort of double
buffering or pageflipping whatsoever was in Pygame,
not just SDL. I’d like to tell you more, but it was a
long time ago on a system long gone.__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/