Article View: comp.os.msdos.programmer
Article #3679Re: flicker free drawing
From: John A. Slagel
Date: Wed, 07 Oct 1992 20:44
Date: Wed, 07 Oct 1992 20:44
57 lines
2859 bytes
2859 bytes
rajiv_sud@sw.stratus.com writes:
> I am writing a graphics application and understand that to do
>flicker free animation one should do the screen update during the
>verticle retrace period. I believe I have a fairly good idea of catching
>the virtcle sycn pulse by setting it to cause a level 2 interrupt in
>turboC. What I am not clear on is how does one determine how much time
>one has to draw i.e., how many assembly instructions can I run. Since
>different instructions take different amounts of time has anyone come
>up with a method to determine when to stop updating the screen?
There are several ways to do flicker free animation....
1. If you're not drawing very many items and you only have 1 page of
video memory:
-Wait for vertical retrace to start.
-Draw the items before vertical retrace ends.
-Interrupts cannot be used... they're very unreliable on most cards.
-So, you need to poll for the vertical retrace to start.
2. If you have 2 pages of video memory:
Loop:
-Draw the items on page 1
-Show page 1
-Wait for vertical retrace
-Erase old stuff on page 2
-Draw new items on page 2
-Show page 2
-Wait for retrace
-Erase items on page 1
-Goto loop
*NOTE: the wait for verticle retrace is to make sure the eletron gun
goes through the new page before you start erasing off the non-
displayed page... If you didn't do this, then you could erase the
sprites before the page flip comes into effect, thus erasing part
of the sprite that is shown... think about it...
3. If you have 3 or more pages of video memory....
This is where you don't need to worry about retrace. No waits
whatsoever...
-Draw on page 1
-Show page 1
-Erase on page 2
-Draw on page 2
-Show page 2
-Erase on page 3
-Draw on page 3
-Show page 3
-Erase on page 1
-go back up to top
Unless your program can update 3 pages in 1 retrace cycle, you
*NEVER* need to wait for verticle retrace!!!!!
--
------------------------------------------------------------------------
"Never believe anything a female says, unless it rips your heart out."
-A brilliant discovery by me on Sept 27, 1992
John A. Slagel, email: jas37876@uxa.cso.uiuc.edu
Technical Details
Message-ID:
<BvrqxE.8GK@news.cso.uiuc.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uxa.cso.uiuc.edu!jas37876References:
<7052@transfer.stratus.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uxa.cso.uiuc.edu!jas37876 From: jas37876@uxa.cso.uiuc.edu (John A. Slagel) Subject: Re: flicker free drawing References: <7052@transfer.stratus.com> Message-ID: <BvrqxE.8GK@news.cso.uiuc.edu> Sender: usenet@news.cso.uiuc.edu (Net Noise owner) Organization: University of Illinois at Urbana Date: Wed, 7 Oct 1992 20:44:00 GMT Lines: 57