fixed: compile issue
[opensg.git] / Tools / osgBench / q4.py
blob8c3634571b9c5d445e4caa8c86cc19b390d33b53
1 # Start as
2 # valgrind --tool=callgrind --instr-atstart=no python q4.py ~/DeereModels/models4dirk/planterHeavy/planter_lod.osb
5 import sys
6 import os
7 import time
8 from osgbench import *
10 def usage():
11 print "usage."
12 return -1
14 def main(argv=sys.argv):
15 if len(argv) < 2:
16 return usage()
18 scene=Group()
20 for i in argv[1:]:
21 print "Loading %s..." % i,
22 sys.stdout.flush()
23 scene.addChild(loadScene(i))
24 print "done"
26 #g = createGraphOp("GeoType")
27 #g.traverse(scene)
29 win = TestWindow()
30 win.setSize(1000,1000)
31 win.open()
33 test = Test()
34 test.setWindow(win)
35 test.setScene(scene)
36 test.setNFrames(200)
38 test.clear()
39 test.addFov(60)
40 test.makeOrbit(0, 0, 1)
41 #test.setIgnoreGeometry(True)
42 test.useRenderTraversal(True)
44 print "Turning on profiling..."
45 os.spawnlp(os.P_NOWAIT,"callgrind_control","callgrind_control","-i","on")
46 time.sleep(4)
48 print "Running test..."
49 test.run()
51 print "Turning off profiling..."
52 os.spawnlp(os.P_NOWAIT,"callgrind_control","callgrind_control","-i","off")
53 time.sleep(4)
55 print "FPS:", test.getFPS()
56 win.close()
58 if __name__ == '__main__':
59 sys.exit(main() or 0)