proc roll {} { global box1 global sphr1 global sphr2 .c rotate $sphr1 x 1.5 .c rotate $sphr2 x -1.5 .c rotate $box1 y 1.5 .c update } canvas3d .c -height 300 -width 300 pack .c update set prj [ .c create matrix -value {{2.0 0.0 0.0 0.0} {0.0 2.0 0.0 0.0} \ {0.0 0.0 1.0 1.0} {0.0 0.0 -2.0 0.0}} ] set wrl [ .c create matrix -value {{1.0 0.0 0.0 0.0} {0.0 1.0 0.0 0.0} \ {0.0 0.0 1.0 0.0} {0.0 0.0 0.0 1.0}} ] set vw [ .c create matrix -value {{1.0 0.0 0.0 0.0} {0.0 1.0 0.0 0.0} \ {0.0 0.0 1.0 0.0} {0.0 0.0 40.0 1.0}} ] set back [ .c create surface ] set view [ .c create viewport -proj $prj -world $wrl -view $vw \ -background $back ] update set tiger [ .c create surface -texture tiger.ppm -ramp 1 ] set checker [ .c create surface -texture checker.ppm -ramp 1 ] set sphr1 [ .c create sphere -radius 10 -surface $checker ] .c translate $sphr1 10 10 1 set sphr2 [ .c create sphere -surface $checker] .c scale $sphr2 5 5 5 .c translate $sphr2 -10 10 1 set box1 [ .c create box -surface $tiger -width 12 -height 12 -depth 12 ] .c rotate $box1 x 1.5 .c rotate $box1 y 1.5 .c update .c itemconfigure $view -viewpoint { 0 0 -5 } .c update button .b -text "Roll" -command roll pack .b