Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!amdahl!oliveb!amiga!bart From: bart@amiga.UUCP (Barry A. Whitebook) Newsgroups: comp.sys.amiga Subject: double buffering... Message-ID: <1965@amiga.amiga.UUCP> Date: Wed, 11-Nov-87 21:26:29 EST Article-I.D.: amiga.1965 Posted: Wed Nov 11 21:26:29 1987 Date-Received: Sat, 14-Nov-87 06:03:02 EST Reply-To: bart@amiga.UUCP (Barry A. Whitebook) Followup-To: bart@amiga.UUCP (Barry A. Whitebook) Organization: Commodore-Amiga Inc, Los Gatos, CA Lines: 67 Keywords: double buffer [ eat this line -- please! ] this is amiga!bart: regarding double buffering of animation... here is what "robo" does ----------------- begin fragment ------------------------- while( ... ) { Animate(&animKey, rp); SortGList(rp); DrawGList(rp,vp); vp->RasInfo->BitMap = &bitmap[dispIndex]; WaitTOF(); MakeScreen(screen); RethinkDisplay(); dispIndex ^= 1; rp->BitMap = &bitmap[dispIndex]; } ----------------- end fragment ------------------------- note that for a non-dualpf screen the RasInfo->Bitmap is used to remake the copper list for this screen which has a non-layered vp. also note that the rp->BitMap change allows for the current DrawGlist() call to take place in the "not-currently-displayed" bitmap. also remember to tell gels that DBUFFER is in effect so that save/restore works properly between bitmaps. another way to double buffer is found in the amiga3d demo which DOES NOT USE gels code to render into its rp->bitmaps, so it incurs less overhead on the double buffering itself by making these calls: ----------------- begin fragment ------------------------- while( ... ) { Forbid(); WaitTOF(); WaitBlit(); Disable(); (&screen->ViewPort)->RasInfo = rip[frametoggle]; ScrollVPort(&screen->ViewPort); Enable(); Permit(); frametoggle ^= 1; } ----------------- end fragment ------------------------- this stuffs alternate rasinfo pointers into the viewport and lets ScrollVPort handle the pokes directly into the copper list. NOTE CAREFULLY: the elaborate Forbid; WaitTOF; Disable; Enable; Permit; nesting are to protect the "currently displayed" copper list from being modified while the copper is fetching instructions from that list. happy hacking. -- //----------------------------------------------------- ----------\\ //| Bart Whitebook | {|V|))) |\\ | | ()^()-)))| | 16795 Lark Avenue, Suite #106, Los Gatos, CA 95030 | /_ ?))| | UUCP: pyramid!oliveb!amiga!bart | { _ } )\ | | BIX: amiga_bart | \ // | \\|_____________________________________________________|__\//____ |// \\ //