GregEnj
08-06-2014, 07:17 AM
Hi there,
I'm trying to plot lots of polygons in the Vizard environment. 99% of the time, the data is perfect. However, under certain circumstances, with ever-so-small data defects, Vizard has trouble handling the tessellation. Sometimes it is due to a tiny bow-bie, however in other instances, huge, valid polygons seem to do it too. GL_POLYGON primitives don't work properly by themselves because they can't handle concave polygons (they seem very similar to triangle fans to be honest)!
I'm particularly interested in using a GL method of converting polygons to triangles, because supposedly the GL tessellation library chooses from various strategies, and it would be nice to choose the least GPU intensive way to keep a decent frame rate. The only problem is I don't seem to get access to this from Vizard from anything other than the 'optimize' function (I could be wrong).
Ideally Vizard would return a tessellated version of a polygon, even if it was a bowtie. If it threw an exception that'd be better (though not perfect), but the total death of the program when a bowtie occurs is a bit of a bummer!
Can you help me by suggesting a way I convert these polygons, or can you fix the bug with Vizard (and possibly suggest a workaround in the meantime)?
Here's a simple way to cause the crash:
import viz
viz.go()
viz.startLayer(viz.POLYGON)
viz.vertex(0,0,0)
viz.vertex(1,1,0)
viz.vertex(1,0,0)
viz.vertex(0,1,0)
bowTie = viz.endLayer()
bowTie.optimize(viz.OPT_TESSELLATE_GEOMETRY)
I've found sometimes running that optimization on complex scenes causes crashes too (if you use viz.OPT_ALL for some OSG objects loaded from disk).
I'm trying to plot lots of polygons in the Vizard environment. 99% of the time, the data is perfect. However, under certain circumstances, with ever-so-small data defects, Vizard has trouble handling the tessellation. Sometimes it is due to a tiny bow-bie, however in other instances, huge, valid polygons seem to do it too. GL_POLYGON primitives don't work properly by themselves because they can't handle concave polygons (they seem very similar to triangle fans to be honest)!
I'm particularly interested in using a GL method of converting polygons to triangles, because supposedly the GL tessellation library chooses from various strategies, and it would be nice to choose the least GPU intensive way to keep a decent frame rate. The only problem is I don't seem to get access to this from Vizard from anything other than the 'optimize' function (I could be wrong).
Ideally Vizard would return a tessellated version of a polygon, even if it was a bowtie. If it threw an exception that'd be better (though not perfect), but the total death of the program when a bowtie occurs is a bit of a bummer!
Can you help me by suggesting a way I convert these polygons, or can you fix the bug with Vizard (and possibly suggest a workaround in the meantime)?
Here's a simple way to cause the crash:
import viz
viz.go()
viz.startLayer(viz.POLYGON)
viz.vertex(0,0,0)
viz.vertex(1,1,0)
viz.vertex(1,0,0)
viz.vertex(0,1,0)
bowTie = viz.endLayer()
bowTie.optimize(viz.OPT_TESSELLATE_GEOMETRY)
I've found sometimes running that optimization on complex scenes causes crashes too (if you use viz.OPT_ALL for some OSG objects loaded from disk).