Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!rutgers!usenet!ogicse!qiclab!percy!tektronix!reed!chaffee From: chaffee@reed.UUCP (Alex Chaffee) Newsgroups: comp.sys.mac.programmer Subject: Re: Can the Mac actually do animation? Summary: Yes. Message-ID: <16301@reed.UUCP> Date: 7 Apr 91 22:54:39 GMT References: <6205@cactus.org> <2966@cod.NOSC.MIL> <314@crucible.UUCP> <552@humu.NOSC.Mil> Organization: Reed College, Portland OR Lines: 66 In <552@humu.NOSC.Mil> page@humu.NOSC.Mil (Ward C. Page) writes: >There are two causes of flicker: the flicker caused by seeing the erase >of the old symbology before the redraw, and the flicker caused when the >gun starts drawing the CopyBits half way through the scan, thus taking >two scan fields (frames) to get the copybits to the screen. Without >syncing to the retrace interval you can't guarantee that you won't see >this. The faster the updates the more you will notice this. Double- >buffering was designed to address both these problems. Without it, you >have to handle it by yourself. How To Handle It By Yourself: void DrawWithoutFlicker() { Wait(); Draw(); } void Wait() { if (Running_On_An_Old_Mac()) { now = TickCount(); while (TickCount() == now) ; } else { WaitForSync(); } } (Where WaitForSync() is in a file I posted a few weeks ago, sync.c. If you'd like a copy of sync.c, let me know. It ties a VBL task to the refresh queue of the main screen.) Pretty simple, huh? The only case where this will fail (that is, flicker) is if the Draw() routine takes more than 1/60 sec. to work. But as long as you're copybitsing from an offscreen bitmap of the same pixel depth as the screen, and you're not trying to copy an image larger than, say, half the screen, this won't happen. > The Mac can't do real double-buffering (although inside Mac claims > otherwise) and it can't transfer bitmaps from on offscreen bitmap during the > vertical retrace. Both wrong, although true double-buffering is not supported on all machines, thus you shouldn't rely on it. References: Usenet Mac Programmers Guide Tech Note # ? (Of Time and Space and Copybits) >Ward Page >Naval Ocean Systems Center >Kaneohe, Hawaii - Alex -- Alex Chaffee chaffee@reed.bitnet Reed College, Portland OR 97202 ____________________