Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!ginosko!brutus.cs.uiuc.edu!apple!rutgers!cmcl2!lanl!opus!ogden From: ogden@nmsu.edu (Bill Ogden) Newsgroups: comp.sys.mac.programmer Subject: Re: Animation Questions Message-ID: Date: 13 Oct 89 17:45:01 GMT References: <3123@crdgw1.crd.ge.com> <10611@claris.com> <34698@srcsip.UUCP> Sender: news@nmsu.edu Organization: NMSU Computer Science Lines: 50 In-reply-to: mnkonar@gorby.SRC.Honeywell.COM's message of 13 Oct 89 00:06:58 GMT In article <34698@srcsip.UUCP> mnkonar@gorby.SRC.Honeywell.COM (Murat N. Konar) writes: >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 use GetVideoDefault to find the slot (but may NOT be the device currently being written to!) and then set up a dummy (do nothing) VBL task which decrements the vblCount every vertical blank period. It seems to work. Here's how I do it: VBLQElPtr vtrace; /* global vertical blank task pointer */ int vSlot; /* global for video slot */ InstallRetracer() /* installs the dummy vbl task in default slot */ { DefVideoRec defaultScreen; GetVideoDefault(&defaultScreen); vSlot = defaultScreen.sdSlot; vtrace =(VBLQElPtr) NewPtr(sizeof(VBLTask)); vtrace->qType = vType; vtrace->vblAddr = DummyVBLTask; vtrace->vblCount = 3000; /* count can be anything */ vtrace->vblPhase = 0; SlotVInstall(vtrace,vSlot); } waitForSync() /* call this to wait for the next vertical blank peroid */ { int wait; wait = vtrace->vblCount; while (vtrace->vblCount == wait); } Be sure and do a SlotVRemove call when you done !! This will only work on MacII's or later. Bill Ogden ogden@nmsu.edu Computing Research Lab / Psychology Dept New Mexico State University