Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!srcsip!gorby!mnkonar From: mnkonar@gorby.SRC.Honeywell.COM (Murat N. Konar) Newsgroups: comp.sys.mac.programmer Subject: Re: Animation Questions Keywords: CopyBits, VBlank Message-ID: <34698@srcsip.UUCP> Date: 13 Oct 89 00:06:58 GMT References: <3123@crdgw1.crd.ge.com> <10611@claris.com> Sender: news@src.honeywell.COM Reply-To: mnkonar@gorby.UUCP (Murat N. Konar) Organization: Honeywell Systems & Research Center, Camden, MN Lines: 43 In article <10611@claris.com= brendan@claris.com (Brendan McCarthy) writes: ==In Article 10142 in comp.sys.mac.programmer: ==leue@galen.crd.ge.com (Bill Leue) writes: = ==First, the objects being animated are sometimes "sheared" horizontally, so ==that they are torn into two pieces which don't quite track each other as the ==object moves (say)horizontally. ==I'm tenatively diagnosing this problem as a lack of synchronization with the ==screen refresh. Am I right? = =Yes, you are right. There's a cheap way to synchronize with the VBL. It works =well for pretty simple drawing tasks (like CopyBits). =Here's a code fragment: = = VAR theTicks: LONGINT; = = BEGIN { your screen drawing routine } = ... = { sync with VBL task } = theTicks := TickCount; = REPEAT UNTIL theTicks <= TickCount; = { do your drawing now } = ... = END; { your drawing routine } I beleive that the above code fragment will only eliminate flicker on Mac Pluses SEs and maybe SE30s. MacII variants may have monitors that have a vertical blanking interval that is different than the normal 1/60 sec. So if you synch up with the Tick counter, you are still out of synch with the Monitor's vertical retrace. The solution appears to be to figure out which monitor you are drawing on (easy, see the chapter on GDevices in IM vol V), figure out what slot that monitor's card is in (don't know how to do that), and then synch up with that slots VBL queue (info for that puzzle is buried in IM vol V also, but not in digestible form). I too am trying to figure out how to do smooth animation on Mac IIs so if anyone out there has got the details figured out, let me know. thanks. ____________________________________________________________________ Have a day. :^| Murat N. Konar Honeywell Systems & Research Center, Camden, MN mnkonar@SRC.honeywell.com (internet) {umn-cs,ems,bthpyd}!srcsip!mnkonar(UUCP)