AOH :: ANIMATE.TXT

Some hints on doing smooth, flicker-free animation on PCs


From: Mbeck
 
Animation really opens a fun can of worms.  Some of the problems are
easily solvable, some just ruin your day.
 
Consider: Horizontal retrace flicker.  You get this when trying to
refresh an image faster than the display system is running.
Solution: Update the displayed image during the vertical retrace
interval.
 
Consider: Still getting flicker because update time is longer than
vertical retrace interval or recalculation time for the next image.
Solution: Go to double-buffering of display memory.  That way you leave
one image up on the display while updating/calculating the next image.
 
Consider: Animation seems too jerky because calculation or refresh time
varies from frame to frame.
Solution: Terrible problem.  Multiple solutions, none very good.  (a)
Determine what the longest time to next frame is and fix all display
events to synchronize on that time.  (b) Don't bother with real-time
animation during calculation... that is, calculate all image frames and
store on a disk, getting rid of calculation time.  Then run a separate
program to display the pre-calculated data.
 
I'm not familiar with the MacIntosh hardware and don't know how to go
about detecting the horizontal/vertical refresh pulse.  On PC's, the
display hardware sets a bit when doing vertical retrace.  BTW, if you're
going to do double-buffering (two separate memory areas to hold image
data), only flip pages during the vertical retrace.  Looks a lot better.
 
Regards,
Mbeck


Make REAL money with your website!

The entire AOH site is optimized to look best in Firefox® 2.0 on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2008 AOH
We do not send spam. If you have received spam bearing an artofhacking.com email address, please forward it with full headers to abuse@artofhacking.com.