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 [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

