|
发表于 2014-5-15 15:56:49
|
显示全部楼层
- osg::ref_ptr<osg::Geode>geode=new osg::Geode;
- osg::ref_ptr<osg::Geometry>geometry=new osg::Geometry;
- _vertexArr->push_back(osg::Vec3(0.0f,0.0f,.0f));
- _vertexArr->push_back(osg::Vec3(2.0f,0.0f,.0f));
- _vertexArr->push_back(osg::Vec3(2.0f,0.0f,2.0f));
- _vertexArr->push_back(osg::Vec3(0.0f,0.0f,2.0f));
- geometry->setVertexArray(_vertexArr);
- geometry->addPrimitiveSet(new osg::DrawArrays(GL_POINTS,0,_vertexArr->size()));
- geometry->setSupportsDisplayList(false);
- geometry->dirtyDisplayList();
- //no use at this moment;
- //geometry->setUpdateCallback(new GeometryUpdate);
- geode->addDrawable(geometry.get());
- geode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
- osg::ref_ptr<osg::Point> pointSize=new osg::Point;
- pointSize->setSize(5.0);
- geode->getOrCreateStateSet()->setAttributeAndModes(pointSize.get(),
- osg::StateAttribute::ON);
- //set dispaly mode as line mode
- /*osg::ref_ptr<osg::PolygonMode> polygonMode = new osg::PolygonMode();
- polygonMode->setMode( osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE);
- geode->getOrCreateStateSet()->setAttribute( polygonMode.get(),
- osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON );*/
- return geode;
复制代码
有的代码对你没用,但是这是可以画点的。 |
|