3 # Use Gouraud shading to mix colors. Requires Z-buffer.
4 # It changes the color assignments so fast that you see white.
5 # Left button pauses, middle rotates the square. ESC to quit.
6 # Experiment with a larger window (too slow) or smaller window (really white).
14 # tekenvlak : draw a square. with bgnpolygon
25 # tekendoos : draw a box
28 v
= [(-5.0,0.0,0.0),(0.0,5.0,0.0),(5.0,0.0,0.0),(0.0,-5.0,0.0)]
29 vc
= [(v
[0],col
[0]),(v
[1],col
[1]),(v
[2],col
[2]),(v
[3],col
[1])]
41 prefposition (100, 500, 100, 500)
42 w
= winopen ('PYTHON RGB')
46 # configure pipeline (2buf, GOURAUD and RGBmode)
56 perspective (900, 1, 1.0, 10.0)
57 polarview (10.0, 0, 0, 0)
59 # ask for the REDRAW and ESCKEY events
61 qdevice(DEVICE
.MOUSE2
)
62 qdevice(DEVICE
.MOUSE3
)
63 qdevice(DEVICE
.REDRAW
)
64 qdevice(DEVICE
.ESCKEY
)
72 # GoForIT : use 2buf to redraw the object 2n times. index i is used as
73 # the (smoothly changing) rotation angle
76 col
= [(255.0,0.0,0.0), (0.0,255.0,0.0), (0.0,0.0,255.0)]
81 col
[0],col
[1],col
[2] = col
[1],col
[2],col
[0]
83 # clear z-buffer and clear background to light-blue
95 if dev
== DEVICE
.ESCKEY
:
97 elif dev
== DEVICE
.REDRAW
:
99 elif dev
== DEVICE
.MOUSE2
and val
<> 0 :
101 perspective (900, 1, 1.0, 10.0)
102 polarview (10.0, 0, 0, twist
)
103 elif dev
== DEVICE
.MOUSE3
and val
<> 0 :