home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / amiga / misc / 18514 < prev    next >
Encoding:
Internet Message Format  |  1992-12-14  |  2.7 KB

  1. 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
  2. Nntp-Posting-Host: holmenkollen.ifi.uio.no
  3. Newsgroups: comp.sys.amiga.misc,comp.sys.amiga.graphics,swnet.sys.amiga,alt.sys.amiga.demos,comp.sys.amiga.programmer
  4. Path: sparky!uunet!mcsun!sunic!ugle.unit.no!nuug!ifi.uio.no!larshaug
  5. From: larshaug@ifi.uio.no (Lars Haugseth)
  6. Subject: Re: Double-buffering, Strange things going on! HELP ME!
  7. Message-ID: <1992Dec14.143015.8151@ifi.uio.no>
  8. Sender: larshaug@ifi.uio.no (Lars Haugseth)
  9. Organization: Dept. of Informatics, University of Oslo, Norway
  10. References:  <1992Dec14.115926.7670@lth.se>
  11. Date: Mon, 14 Dec 1992 14:30:15 GMT
  12. Lines: 58
  13. Originator: larshaug@holmenkollen.ifi.uio.no
  14.  
  15.  
  16. In article <1992Dec14.115926.7670@lth.se>, dat91lho@ludat.lth.se (Lars Holmgren) writes:
  17. > I'm  having some problems with double-buffered
  18. > graphics!
  19. > Let's say that I'm doing some 3d-calculations and
  20. > some plotting of stars (or vector-graphics.)
  21. > The main loop would look something like this (pseudo):
  22. > loop:    swap_screens(1,2)->(2,1)
  23. >     show_screen(1)
  24. >     clear_screen(2)
  25. >     calculate_3d
  26. >     draw_on_screen(2)
  27. >     wait_for_Vertical_blanking
  28. >     go_to loop
  29. > This works perfectly as long as everything runs in
  30. > one frame (or is it field?), 1/50th s. in PAL. If
  31. > the loop needs more time than that it should run
  32. > smooth, but slower! (I know that it's not good, but
  33. > that's not the point!) However, it looks terrible!
  34. > Imagine that I just draw one star and put a delay
  35. > to make the loop slow down enough. This will have
  36. > the effect of seeing _TWO_ stars, one at the old
  37. > position and one at the new! Even if I make the
  38. > delay huge enough to make the loop run just once
  39. > a sec. the star will seem double for 1/50th sec!
  40.  
  41. Have you ever tried triple-buffering? That should do
  42. the trick. I used it in the star-routine I posted here
  43. some weeks ago. Works fine. Then you don't even have to
  44. wait for the clearing to finish before starting to draw:
  45.  
  46. LOOP:    wait_VBlank
  47.     swap_screens(1,2,3)->(2,3,1)
  48.     show_screen(1)
  49.     clear_screen(3)
  50.     draw_screen(2)    (while clear_screen is still running)
  51.     bra LOOP
  52.  
  53. > /Lars
  54.  
  55. Right! 8-)
  56.  
  57. +-----------------------------------------------------------+
  58. | Lars Haugseth                                             +-+
  59. | Dept. of Informatics,               <larshaug@ifi.uio.no> | |
  60. | University of Oslo, Norway                                | |
  61. |                                                           | |
  62. |          If idiots could fly, this would be an airport... | |
  63. +-+---------------------------------------------------------+ |
  64.   +-----------------------------------------------------------+
  65.  
  66.