[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob/vob/demo/multifil randgraph.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] libvob/vob/demo/multifil randgraph.py |
Date: |
Wed, 09 Jul 2003 06:52:23 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Janne V. Kujala <address@hidden> 03/07/09 06:52:23
Modified files:
vob/demo/multifil: randgraph.py
Log message:
Try to use a display list
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil/randgraph.py.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
Patches:
Index: libvob/vob/demo/multifil/randgraph.py
diff -u libvob/vob/demo/multifil/randgraph.py:1.23
libvob/vob/demo/multifil/randgraph.py:1.24
--- libvob/vob/demo/multifil/randgraph.py:1.23 Sun Jun 29 07:22:07 2003
+++ libvob/vob/demo/multifil/randgraph.py Wed Jul 9 06:52:23 2003
@@ -29,6 +29,7 @@
from vob.putil.demokeys import *
from vob.fillet import light3d
+from vob.putil.demowindow import w
from random import Random
@@ -40,27 +41,31 @@
SlideLin("x", 200, 20, "x", "Left", "Right"),
SlideLin("y", 300, 20, "y", "Up", "Down"),
SlideLin("ang", 21, 3, "Rotation angle", "Prior", "Next"),
+ Action("Use display list", "D", self.compile, noAnimation=1),
*light3d.commonkeys
)
- def scene(self, vs):
- vs.put( background((.5,1,.2)))
+ self.list = None
+
+ def compile(self, *args):
+ if self.list:
+ self.list = None
+ return
+
+ list = GL.createDisplayList();
+ print w
+ vs = w.createVobScene()
+ self.putGraph(vs, 0, 800);
+
+ list.startCompile(w.window)
+ w.renderStill(vs, 0)
+ list.endCompile(w.window)
+ self.list = GLRen.createCallListCoorded(list)
+
+ def putGraph(self, vs, cs, box):
rng = Random(self.seed)
N2 = 2*self.N/3
- box = 800
-
- cs = vs.scaleCS(0, "cs", 1, 1, 1)
- size = vs.getSize()
- cs = vs.translateCS(cs, "Trans",
- 0.5 * size.width,
- 0.5 * size.height,
- 0.5 * box);
-
- cs = vs.coords.rotateXYZ(cs, 0, 1, 0, self.ang);
- vs.matcher.add(cs, "Rot")
-
-
nodes = [ {
"cs" : vs.orthoBoxCS(cs, "node%s" % i,
(rng.random() - .5) * box,
@@ -88,3 +93,23 @@
vs.put(conns, cs + [node["cs"]] + node["conns"])
light3d.drawFillets(self, vs, pc)
+
+ def scene(self, vs):
+ vs.put( background((.5,1,.2)))
+
+ box = 800
+
+ cs = vs.scaleCS(0, "cs", 1, 1, 1)
+ size = vs.getSize()
+ cs = vs.translateCS(cs, "Trans",
+ 0.5 * size.width,
+ 0.5 * size.height,
+ 0.5 * box);
+
+ cs = vs.coords.rotateXYZ(cs, 0, 1, 0, self.ang);
+ vs.matcher.add(cs, "Rot")
+
+ if self.list:
+ vs.put(self.list, cs)
+ else:
+ self.putGraph(vs, cs, box)
- [Gzz-commits] libvob/vob/demo/multifil randgraph.py,
Janne V. Kujala <=