fixed: Windows removed context when exiting from a passive window (thanks to M. Raab...
[opensg.git] / Tools / osgBench / test_hnodes.py
blob8c0f268f143d39f392505b1e3b1e34d92c8401de
1 # Simple OpenSG benchmark
2 from osgbench import *
4 # Define the Window's parameters
5 win=TestWindow()
6 win.setSize(300,300)
7 win.open()
9 # Create the scene
10 scene=Group()
12 nc=8
14 scene=Group()
16 for i in range(-nc,nc):
17 inode=Group()
18 scene.addChild(inode)
19 for j in range(-nc,nc):
20 jnode=Group()
21 inode.addChild(jnode)
22 for k in range(-nc,nc):
23 geo=makeBox(1,1,1, 1,1,1)
24 geo.translate(i*2, j*2, k*2)
25 jnode.addChild(geo)
27 # Define the Test(s)
28 test=Test()
29 test.setWindow(win)
30 test.setNFrames(100)
31 test.setMinTime(5)
32 test.setScene(scene)
33 test.setStatistics(1)
35 test.addFov(90)
36 test.makeOrbit(0,1,0)
38 test.run()
40 print "%d transformed cubes took %f seconds: %f fps" % ((nc*2)*(nc*2)*(nc*2), test.getTime(), test.getFPS())
42 culled=0
43 culltested=0
45 for i in range(0,test.getNRenderedFrames()):
46 culled += test.getStatValue("culledNodes", i)
47 culltested += test.getStatValue("cullTestedNodes", i)
49 print "%d nodes culled, %d nodes culltested" % (culled, culltested)