[SDL] Better performance needed - am I doing this right?
David Olofson
david at olofson.net
Wed Jun 6 14:10:52 PDT 2007
On Wednesday 06 June 2007, Colin Tuckley wrote:
> Sam Lantinga wrote:
>
> > Usually what people do is do all the drawing for a single frame
> > and then when they're all done and want to flush the changes so
> > they are visible, then they call SDL_Flip(). You definitely don't
> > want to do it when you are still busy drawing things like the
> > cursor.
>
> I realise this, however this isn't a game, it's a BASIC interpreter.
> There are times when the user is doing screen editing for example
> that he needs to see the cursor movement for *every* keypress. It
> makes the logic complicated, I try to work out how interactive the
> current situation is and adjust the update/flush accordingly.
Usually, even if you do a full screen redraw every frame
(with "reasonable" resolutions), you get frame rates at least twice
as high as the fastest keyboard repeat rates normally available.
There should be only two cases where you *really* need to update some
8x8 pixels or so at a time:
1. You want to use as little CPU time as possible.
2. You need *insane* frame rates (1000+ fps) to
get ultra smooth, tearing free animation without
retrace sync.
The first one is always a good idea, of course - although usually, you
also need to get the job done, so "First make it work, then make it
work fast."
The second one is really only an option for games with mostly still
screens and a few small moving objects, and it's just a last resort
if you can't do it properly - that is, using a retrace synchronized
double (or triple) buffered display. (The higher the frame rate, the
smaller the difference between frames, and thus, the less tearing and
refresh/frame rate interfecence.)
//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