I'm trying to do a bouncing ball simulation and use plplot for the
graphics utility. Here's a simple piece of code I've been trying to get
to work:
open Plplot
let green = 3 ;;
let black = 0 ;;
let hide () =
plcol0 black ;
plarc 0.5 0.5 0.031 0.031 0.0 360.0 true
let show () =
plcol0 green ;
plarc 0.5 0.5 0.031 0.031 0.0 360.0 true
let wait secs =
let t0 = Sys.time () in
while ((Sys.time () -. t0)) < secs do
print_string ""
done ;;
let run () =
plbop () ;
plssub 1 1 ;
plcol0 green ;
pladv 1 ;
plvpas 0.0 1.0 0.0 1.0 1.0 ;
plwind 0.0 1.0 0.0 1.0 ;
show () ;
wait 1.0 ;
hide () ;
wait 1.0 ;
show ()
let main () =
plsdev "xcairo" ;
plinit () ;
run () ;
plend () ;;
let () = main () ;;
While this is written in OCaml, it's close to what it would look like in
C. I'm trying to plot a green circle, wait for one second, plot a black
circle over the green circle (erase it), wait another second, and then
plot the green circle again. There are two problems I have with this
code:
1) If I remove everything in the run () function after the first show ()
function, this works exactly as I expect. I get a green circle in the
middle of the graphics screen. If I add the first wait (), then I don't
see the green circle until after the wait () has executed. Is there any
way to get the screen to update immediately after the show () function?
2) Is it possible to draw multiple times to the same sub-screen and if
so , can you point me in the right direction?
Thanks.
--
Bruce
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Plplot-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-general