Hi!
Thanks Robert for pointing out the OpenGL docs. I managed to show the
"dashed" line.
Here's the final code:
osg::ref_ptr<osg::Vec3Array> dash_points = new osg::Vec3Array;
osg::ref_ptr<osg::Vec4Array> dash_color = new osg::Vec4Array;
osg::ref_ptr<osg::Geometry> dash_geometry( new osg::Geometry);
dash_color->push_back(osg::Vec4f(0.0,0.0,1.0,1.0));
dash_points->push_back(P1);
dash_points->push_back(P2);
dash_geometry->setVertexArray(dash_points.get());
dash_geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
osg::ref_ptr<osg::LineStipple> linestipple( new
osg::LineStipple(2, 0xAAAA) );
dash_geometry->getOrCreateStateSet()->setAttributeAndModes(linestipple.get(),
osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE );
dash_geometry->addPrimitiveSet( new
osg::DrawArrays(GL_LINES,0,dash_points->size()) );
dash_geometry->getOrCreateStateSet()->setAttributeAndModes( new
osg::Point(5.0f) );
dash_geometry->addPrimitiveSet(new osg::DrawArrays(GL_POINTS, 0,
dash_points->size()));
dash_geometry->setColorArray(dash_color.get());
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org