[SDL] Re: Doublebuffering access to front and backbuffer?

Daniel Phillips phillips at arcor.de
Fri Jan 3 07:29:01 PST 2003

On Wednesday 01 January 2003 08:09, Ney André de Mello Zunino wrote:
> M. Egmond wrote:
> [...]
> > So is it possible to get a pointer to the front buffer (which is easy in
> > DirectX) or write (blit) to the front buffer directly?
> I might me missing something, but why not just blit to the back buffer
> before flipping?

Unless you are always able to run well over 30 fps, the difference between 
drawing into the buffer and drawing directly on the screen for things like 
text and cursors is very easy to feel, i.e., 33 ms is too much for cursor 
movement or keyboard feedback, whereas it is perfectly acceptable for 3D 
object rendering.

Combining drawing a sprite, say, into the buffer and drawing the same sprite 
directly to the screen at a higher framerate (don't forget to draw it into 
the back buffer first, or it will rip) is a technique I've used with success, 
and which I consider essential for achieving that smooth, professional feel 
for a 3D app, especially an editor.

Run a slow animation, and you will notice that the X cursor already works 
this way, though I doubt that's explicitly part of SDL.

A quick tour of the source suggest SDL doesn't have an API for this yet.  
Technically, it's not hard, but getting it totally generic and convenient is 
hard.  My recommendation to the orignal poster:  just get the SDL source, 
hack it in the way that works for you in your configuration, then post your 
hack for discussion.


More information about the SDL mailing list