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

  1. 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
  2. Path: sparky!uunet!cs.utexas.edu!usc!hela.iti.org!cs.widener.edu!dsinc!bagate!cbmvax!chrisg
  3. From: chrisg@cbmvax.commodore.com (Chris Green)
  4. Newsgroups: comp.sys.amiga.misc,comp.sys.amiga.graphics,swnet.sys.amiga,alt.sys.amiga.demos,comp.sys.amiga.programmer
  5. Subject: Re: Double-buffering, Strange things going on! HELP ME!
  6. Message-ID: <37898@cbmvax.commodore.com>
  7. Date: 15 Dec 92 12:59:31 GMT
  8. References: <1992Dec14.115926.7670@lth.se>
  9. Reply-To: chrisg@cbmvax.commodore.com (Chris Green)
  10. Organization: Commodore, West Chester, PA
  11. Lines: 46
  12.  
  13. In article <1992Dec14.115926.7670@lth.se> dat91lho@ludat.lth.se (Lars Holmgren) writes:
  14. >I'm  having some problems with double-buffered
  15. >graphics!
  16. >
  17. >Let's say that I'm doing some 3d-calculations and
  18. >some plotting of stars (or vector-graphics.)
  19. >The main loop would look something like this (pseudo):
  20. >
  21. >loop:    swap_screens(1,2)->(2,1)
  22. >    show_screen(1)
  23. >    clear_screen(2)
  24. >
  25. >    calculate_3d
  26. >    draw_on_screen(2)
  27. >
  28. >    wait_for_Vertical_blanking
  29. >    go_to loop
  30. >
  31.  
  32.   Before the clear_screen, you need to do a "wait_for_screen_to_really_swap()".
  33. Since (most likely) your show_screen() call has the effect of changing the 
  34. copper list to reflect the other bitmap, it does not immediately take
  35. effect. Thus, your clear_screen is writing into the currently displayed
  36. bitmap. The solution is either to wait between swapping and drawing,
  37. or to triple buffer. Since you're doing 3d calculations, a reasonable way to
  38. set up the loop is:
  39.  
  40.     i=0
  41.     clear_screen(0)
  42. loop:    show_screen(i)
  43.     i^=1;
  44.     do all 3d calculations
  45.     wait for screens to be swapped (hopefully enough time
  46.         occurred during the calculations for this to already
  47.         have happened)
  48.     clear_screen(i)
  49.     draw_screen(i)
  50.     go to loop
  51. -- 
  52. *-------------------------------------------*---------------------------*
  53. |Chris Green - Graphics Software Engineer   - chrisg@commodore.COM      f
  54. |                  Commodore-Amiga          - uunet!cbmvax!chrisg       n
  55. |My opinions are my own, and do not         - icantforgettheimpression  o
  56. |necessarily represent those of my employer.- youmadeyouleftaholeinthe  r
  57. |"A screaming comes across the sky..."      - backofmyhead              d
  58. *-------------------------------------------*---------------------------*
  59.