home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.amiga.misc:18514 comp.sys.amiga.graphics:8024 swnet.sys.amiga:183 alt.sys.amiga.demos:1984 comp.sys.amiga.programmer:17335
- Nntp-Posting-Host: holmenkollen.ifi.uio.no
- Newsgroups: comp.sys.amiga.misc,comp.sys.amiga.graphics,swnet.sys.amiga,alt.sys.amiga.demos,comp.sys.amiga.programmer
- Path: sparky!uunet!mcsun!sunic!ugle.unit.no!nuug!ifi.uio.no!larshaug
- From: larshaug@ifi.uio.no (Lars Haugseth)
- Subject: Re: Double-buffering, Strange things going on! HELP ME!
- Message-ID: <1992Dec14.143015.8151@ifi.uio.no>
- Sender: larshaug@ifi.uio.no (Lars Haugseth)
- Organization: Dept. of Informatics, University of Oslo, Norway
- References: <1992Dec14.115926.7670@lth.se>
- Date: Mon, 14 Dec 1992 14:30:15 GMT
- Lines: 58
- Originator: larshaug@holmenkollen.ifi.uio.no
-
-
- 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
- >
- > This works perfectly as long as everything runs in
- > one frame (or is it field?), 1/50th s. in PAL. If
- > the loop needs more time than that it should run
- > smooth, but slower! (I know that it's not good, but
- > that's not the point!) However, it looks terrible!
- > Imagine that I just draw one star and put a delay
- > to make the loop slow down enough. This will have
- > the effect of seeing _TWO_ stars, one at the old
- > position and one at the new! Even if I make the
- > delay huge enough to make the loop run just once
- > a sec. the star will seem double for 1/50th sec!
-
- Have you ever tried triple-buffering? That should do
- the trick. I used it in the star-routine I posted here
- some weeks ago. Works fine. Then you don't even have to
- wait for the clearing to finish before starting to draw:
-
- LOOP: wait_VBlank
- swap_screens(1,2,3)->(2,3,1)
- show_screen(1)
- clear_screen(3)
- draw_screen(2) (while clear_screen is still running)
- bra LOOP
-
- >
- > /Lars
-
- Right! 8-)
-
- +-----------------------------------------------------------+
- | Lars Haugseth +-+
- | Dept. of Informatics, <larshaug@ifi.uio.no> | |
- | University of Oslo, Norway | |
- | | |
- | If idiots could fly, this would be an airport... | |
- +-+---------------------------------------------------------+ |
- +-----------------------------------------------------------+
-
-