|
楼主 |
发表于 2013-6-3 21:09:48
|
显示全部楼层
谢谢大家的建议 最后是这么做的
osg::ref_ptr<osg::Vec3Array> v=new osg::Vec3Array();
v->push_back(pFromPoint);
v->push_back(pMidPoint);
v->push_back(pToPoint);
osg::ref_ptr<osg::Vec4Array> c = new osg::Vec4Array;
c->push_back(osg::Vec4(0.f,1.f,0.f,1.f));
c->push_back(osg::Vec4(1.f,0.f,0.f,1.f));
pLine->setColorArray(c.get());
pLine->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE_SET );
pLine->setVertexArray(v.get());
pLine->addPrimitiveSet(new osg:rawArrays(osg:rimitiveSet:INES,0,2));
pLine->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,1,2));
pGeode->addDrawable(pLine.get()); |
|