home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!caen!zaphod.mps.ohio-state.edu!not-for-mail
- From: gregt@function.mps.ohio-state.edu (Gregory M Ferrar)
- Newsgroups: comp.sys.mac.programmer
- Subject: Using VBL for animation
- Date: 11 Dec 1992 17:17:18 -0500
- Organization: Department of Mathematics, The Ohio State University
- Lines: 54
- Message-ID: <1gb41eINNqe4@function.mps.ohio-state.edu>
- NNTP-Posting-Host: function.mps.ohio-state.edu
-
- I'm trying to create fast, flicker-free animation. I'm using a Quadra 700
- with a 16" monitor, which is my startup screen, and two 12" monitors.
-
- I am currently installing a VBL task in the startup screen's VBL list. This
- task simply sets a variable to TRUE. The theory is that when I am ready to
- draw the screen, I can just set that variable to FALSE, wait for it to become
- TRUE, and then draw quickly. However, when I do this, I STILL get retrace
- lines in the middle of my animation.
-
- Here's the code:
-
- -------------------------------------------------------------------------
-
- void install_vbl_task(void)
- {
-
- short error;
- DefVideoRec video_info;
-
- /* Find the slot number of the video card */
- GetVideoDefault (&video_info);
-
- /* Install the screen refresh interrupt */
- refresh_task.the_vbl_task.qType = vType;
- refresh_task.the_vbl_task.vblAddr = (ProcPtr) set_refresh_flag;
- refresh_task.the_vbl_task.vblCount = VBLS_BETWEEN_FRAMES;
- refresh_task.the_vbl_task.vblPhase = 0;
-
- /* Save the applications's A5 where the VBL task can find it */
- refresh_task.application_A5 = (long) CurrentA5;
-
- /* Install the task */
- error = SlotVInstall((QElemPtr)&refresh_task.the_vbl_task,
- video_info.sdSlot);
-
- } /* install_vbl_task() */
-
- -------------------------------------------------------------------------
-
- The task itself simply restores A5, sets the Boolean global, resets its
- counter, gets the old A5 back, and quits.
-
- Judging by the way the animation looks, the redraws are correctly SPACED but
- are offset from where they should be-- the vbl lines are always in the same
- places, indicating that animation is in fact in synch with VBL but not in
- phase.
-
- The time taken to draw is extremely small-- roughly 150,000 move.l instructions
- on a Quadra 700.
-
- Any suggestions? Am I doing something stupid? I sincerely appreciate any
- suggestions.
-
- -Greg Ferrar (gregt@function.mps.ohio-state.edu)
-