Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!apple!well!oster From: oster@well.sf.ca.us (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: Who cares about sync? (was Re: Animation) Message-ID: <23167@well.sf.ca.us> Date: 15 Feb 91 07:39:24 GMT References: <1991Feb11.142307.38779@eagle.wesleyan.edu> <0biMyLy00UgKA__1sc@andrew.cmu.edu> Distribution: na Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 35 There is far too much worrying about Synch in the this newsgroup. The basic problem is flicker. The root cause of flicker hjas nothing to do with synching to the video. The root cause is not doing enough double buffering. Suppose you want to move an object over a background. the object starts at 0,0, and the next frame shows it at 1,1. The worst way to do it is: 1.) erase the object at 0,0 (either by xor drawing or restoring the background) 2.) draw the object at the new position A bad way to do it is: 1.) draw the object at the new position 2.) erase the object at 0,0. Both of these have a transient state, BETWEEN steps 1 and 2 where the display is "messed up". In method 1, the object is missing. This is percieved as flicker. in methos 2, the object is present more than once. If you are lucky, this will be percieved as motion blur. (Which will actually make the motion more realistic, since we are used to motion blur from movies and TV) More likely, it will be percieved as flicker. The best way to do the job is: 1.) Do either of the above algorithms to an offscreen bitmap/pixmap 2.) CopyBits the smallest area you can to simultaneously replace the old posiition by background, and draw the new. This way, there is no transient improper state, hence no flicker. When Bill Atkinson was writing the lasso in MacPaint, which allows you to drag around a quite large irregularly shaped object, he discovered that although the animation frame rrate decreased when he installed off-screen buffering, the user's perception was that it was FASTER, because it stopped flickering. -- -- David Phillip Oster - At least the government doesn't make death worse. -- oster@well.sf.ca.us = {backbone}!well!oster