home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.amiga.misc:18806 comp.sys.amiga.graphics:8098 swnet.sys.amiga:200 alt.sys.amiga.demos:2029 comp.sys.amiga.programmer:17567
- Path: sparky!uunet!cs.utexas.edu!usc!hela.iti.org!cs.widener.edu!dsinc!bagate!cbmvax!chrisg
- From: chrisg@cbmvax.commodore.com (Chris Green)
- Newsgroups: comp.sys.amiga.misc,comp.sys.amiga.graphics,swnet.sys.amiga,alt.sys.amiga.demos,comp.sys.amiga.programmer
- Subject: Re: Double-buffering, Strange things going on! HELP ME!
- Message-ID: <37898@cbmvax.commodore.com>
- Date: 15 Dec 92 12:59:31 GMT
- References: <1992Dec14.115926.7670@lth.se>
- Reply-To: chrisg@cbmvax.commodore.com (Chris Green)
- Organization: Commodore, West Chester, PA
- Lines: 46
-
- In article <1992Dec14.115926.7670@lth.se> dat91lho@ludat.lth.se (Lars Holmgren) writes:
- >I'm having some problems with double-buffered
- >graphics!
- >
- >Let's say that I'm doing some 3d-calculations and
- >some plotting of stars (or vector-graphics.)
- >The main loop would look something like this (pseudo):
- >
- >loop: swap_screens(1,2)->(2,1)
- > show_screen(1)
- > clear_screen(2)
- >
- > calculate_3d
- > draw_on_screen(2)
- >
- > wait_for_Vertical_blanking
- > go_to loop
- >
-
- Before the clear_screen, you need to do a "wait_for_screen_to_really_swap()".
- Since (most likely) your show_screen() call has the effect of changing the
- copper list to reflect the other bitmap, it does not immediately take
- effect. Thus, your clear_screen is writing into the currently displayed
- bitmap. The solution is either to wait between swapping and drawing,
- or to triple buffer. Since you're doing 3d calculations, a reasonable way to
- set up the loop is:
-
- i=0
- clear_screen(0)
- loop: show_screen(i)
- i^=1;
- do all 3d calculations
- wait for screens to be swapped (hopefully enough time
- occurred during the calculations for this to already
- have happened)
- clear_screen(i)
- draw_screen(i)
- go to loop
- --
- *-------------------------------------------*---------------------------*
- |Chris Green - Graphics Software Engineer - chrisg@commodore.COM f
- | Commodore-Amiga - uunet!cbmvax!chrisg n
- |My opinions are my own, and do not - icantforgettheimpression o
- |necessarily represent those of my employer.- youmadeyouleftaholeinthe r
- |"A screaming comes across the sky..." - backofmyhead d
- *-------------------------------------------*---------------------------*
-