aboutsummaryrefslogtreecommitdiff
path: root/demo/sgi/gl/mixing.py
diff options
context:
space:
mode:
authorSkip Montanaro <[email protected]>2021-02-16 20:14:16 -0600
committerSkip Montanaro <[email protected]>2021-02-16 20:14:16 -0600
commitc2587c76f1b416cdbecb979e54941933246bf856 (patch)
treebb61ee9128075ce22af4eafa232f13c2e5a07896 /demo/sgi/gl/mixing.py
parentd90761a005b24018ae237bf551515772a1de656f (diff)
downloadpython-0.9.1-patched-QoL-c2587c76f1b416cdbecb979e54941933246bf856.tar.xz
python-0.9.1-patched-QoL-c2587c76f1b416cdbecb979e54941933246bf856.zip
starting over
Diffstat (limited to 'demo/sgi/gl/mixing.py')
-rwxr-xr-xdemo/sgi/gl/mixing.py148
1 files changed, 74 insertions, 74 deletions
diff --git a/demo/sgi/gl/mixing.py b/demo/sgi/gl/mixing.py
index 294e65f..85af96c 100755
--- a/demo/sgi/gl/mixing.py
+++ b/demo/sgi/gl/mixing.py
@@ -1,8 +1,8 @@
#! /ufs/guido/bin/sgi/python
-# Use Gouraud shading to mix colors. Requires Z-buffer.
+# Use Gouraud shading to mix colors. Requires Z-buffer.
# It changes the color assignments so fast that you see white.
-# Left button pauses, middle rotates the square. ESC to quit.
+# Left button pauses, middle rotates the square. ESC to quit.
# Experiment with a larger window (too slow) or smaller window (really white).
from GL import *
@@ -11,57 +11,57 @@ import DEVICE
from math import *
#
-# tekenvlak : draw a square. with bgnpolygon
+# tekenvlak : draw a square. with bgnpolygon
#
def tekenvlak (vc) :
- bgnpolygon()
- #vcarray (vc)
- for i in vc :
- c3f (i[1])
- v3f (i[0])
- endpolygon()
+ bgnpolygon()
+ #vcarray (vc)
+ for i in vc :
+ c3f (i[1])
+ v3f (i[0])
+ endpolygon()
#
# tekendoos : draw a box
#
def tekendoos (col) :
- 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)]
- vc = [(v[0],col[0]),(v[1],col[1]),(v[2],col[2]),(v[3],col[1])]
- tekenvlak (vc)
+ 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)]
+ vc = [(v[0],col[0]),(v[1],col[1]),(v[2],col[2]),(v[3],col[1])]
+ tekenvlak (vc)
#
# initialize gl
#
def initgl () :
- #
- # open window
- #
- foreground ()
- keepaspect (1, 1)
- prefposition (100, 500, 100, 500)
- w = winopen ('PYTHON RGB')
- keepaspect (1, 1)
- winconstraints()
- #
- # configure pipeline (2buf, GOURAUD and RGBmode)
- #
- doublebuffer ()
- zbuffer (1)
- shademodel (GOURAUD)
- RGBmode ()
- gconfig ()
- #
- # set viewing
- #
- perspective (900, 1, 1.0, 10.0)
- polarview (10.0, 0, 0, 0)
- #
- # ask for the REDRAW and ESCKEY events
- #
- qdevice(DEVICE.MOUSE2)
- qdevice(DEVICE.MOUSE3)
- qdevice(DEVICE.REDRAW)
- qdevice(DEVICE.ESCKEY)
+ #
+ # open window
+ #
+ foreground ()
+ keepaspect (1, 1)
+ prefposition (100, 500, 100, 500)
+ w = winopen ('PYTHON RGB')
+ keepaspect (1, 1)
+ winconstraints()
+ #
+ # configure pipeline (2buf, GOURAUD and RGBmode)
+ #
+ doublebuffer ()
+ zbuffer (1)
+ shademodel (GOURAUD)
+ RGBmode ()
+ gconfig ()
+ #
+ # set viewing
+ #
+ perspective (900, 1, 1.0, 10.0)
+ polarview (10.0, 0, 0, 0)
+ #
+ # ask for the REDRAW and ESCKEY events
+ #
+ qdevice(DEVICE.MOUSE2)
+ qdevice(DEVICE.MOUSE3)
+ qdevice(DEVICE.REDRAW)
+ qdevice(DEVICE.ESCKEY)
#
@@ -69,48 +69,48 @@ def initgl () :
#
black = 0
#
-# GoForIT : use 2buf to redraw the object 2n times. index i is used as
+# GoForIT : use 2buf to redraw the object 2n times. index i is used as
# the (smoothly changing) rotation angle
#
def GoForIt(i) :
- col = [(255.0,0.0,0.0), (0.0,255.0,0.0), (0.0,0.0,255.0)]
- twist = 0
- freeze = 1
- while 1 :
- if freeze <> 0 :
- col[0],col[1],col[2] = col[1],col[2],col[0]
- #
- # clear z-buffer and clear background to light-blue
- #
- zclear()
- cpack (black)
- clear()
- #
- tekendoos (col)
- #
- swapbuffers()
- #
- if qtest() <> 0 :
- dev, val = qread()
- if dev = DEVICE.ESCKEY :
- break
- elif dev = DEVICE.REDRAW :
- reshapeviewport ()
- elif dev = DEVICE.MOUSE2 and val <> 0 :
- twist = twist + 30
- perspective (900, 1, 1.0, 10.0)
- polarview (10.0, 0, 0, twist)
- elif dev = DEVICE.MOUSE3 and val <> 0 :
- freeze = 1 - freeze
+ col = [(255.0,0.0,0.0), (0.0,255.0,0.0), (0.0,0.0,255.0)]
+ twist = 0
+ freeze = 1
+ while 1 :
+ if freeze <> 0 :
+ col[0],col[1],col[2] = col[1],col[2],col[0]
+ #
+ # clear z-buffer and clear background to light-blue
+ #
+ zclear()
+ cpack (black)
+ clear()
+ #
+ tekendoos (col)
+ #
+ swapbuffers()
+ #
+ if qtest() <> 0 :
+ dev, val = qread()
+ if dev = DEVICE.ESCKEY :
+ break
+ elif dev = DEVICE.REDRAW :
+ reshapeviewport ()
+ elif dev = DEVICE.MOUSE2 and val <> 0 :
+ twist = twist + 30
+ perspective (900, 1, 1.0, 10.0)
+ polarview (10.0, 0, 0, twist)
+ elif dev = DEVICE.MOUSE3 and val <> 0 :
+ freeze = 1 - freeze
# the main program
#
def main () :
- initgl ()
- GoForIt (0)
+ initgl ()
+ GoForIt (0)
#
# exec main
#
-main ()
+main ()