canvas3d .c -width 300 -height 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 lena [ .c create surface -texture lena.ppm -ramp 1 ]

set box [ .c create box -width 16 -height 16 -depth 16 -surface $lena ]
.c rotate $box y -0.75
.c rotate $box x 0.5
.c update

button .x -text "ROTATE X" -command ".c rotate $box x 0.2; .c update"
button .y -text "ROTATE Y" -command ".c rotate $box y 0.2; .c update" 
button .z -text "ROTATE Z" -command ".c rotate $box z 0.2; .c update" 
pack .x .y .z -side left -padx 5