from a quick look, it appears your geometry is just two adjacent quads (ie 4 triangles), no? No need to invoke a tesselator for a concave polygon. Just use 3 verts for each of the 4 triangles (12 verts total) and draw as GL_TRIANGLES.
cheers -- mew On Wed, Apr 23, 2008 at 2:34 PM, R Schwantes <[EMAIL PROTECTED]> wrote: > Hi list, > > I've been a long time lurker. Finally have some free time to get my hands > dirty with OSG. I'm new to computer graphics, and so far its definitely > been an adventure. > > I'm stuck trying to draw a concave polygon, it looks like I need to use > tessellation to break the geometry down into smaller convex parts? I wrote > some code using osgUtil::Tessellator but it doesn't work quite right. If I > set boundryOnly = true, it looks how I would want it. If boundryOnly is set > to false the polygon is not shaped correctly, and in this example is > splintered into two parts. > > I've attached my code, can someone point me in the right direction? > > > Thanks, > Rick > > ..... > > /* Polygon should look similar to > * > * _______ > * | | > * |____ |_ > * | | > * | | > * | | > * |____| > */ > osg::Geometry* geom = new osg::Geometry; > > osg::Vec3Array* vertices = new osg::Vec3Array; > vertices->push_back(osg::Vec3(0,68,0)); > vertices->push_back(osg::Vec3(0,57,0)); > vertices->push_back(osg::Vec3(86,57,0)); > vertices->push_back(osg::Vec3(86,0,0)); > vertices->push_back(osg::Vec3(98,0,0)); > vertices->push_back(osg::Vec3(98,57,0)); > vertices->push_back(osg::Vec3(92,57,0)); > vertices->push_back(osg::Vec3(92,68,0)); > geom->setVertexArray(vertices); > > geom->addPrimitiveSet(new > osg::DrawArrays(GL_POLYGON,0,vertices->getNumElements())); > > osgUtil::Tessellator* tessellator = new osgUtil::Tessellator(); > tessellator->setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY); > tessellator->setBoundaryOnly(True); > tessellator->setWindingType( osgUtil::Tessellator::TESS_WINDING_ODD); > tessellator->retessellatePolygons(*geom); > > buildingGeode->addDrawable(geom); > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- Mike Weiblen -- Austin Texas USA -- http://mew.cx/ _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org