|
- osg::Geode* geode = new osg::Geode;
- osg::Geometry* nowGeom = new osg::Geometry;
- nowGeom->addPrimitiveSet(new osg::DrawArrays(GL_POINTS,0,2));
- osg::Vec3Array* color2 = new osg::Vec3Array;
- color2->push_back(osg::Vec3(0.0,1.0,1.0));
- nowGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
- nowGeom->setColorArray(color2);
- osg::Vec3Array* vertex = new osg::Vec3Array;
- nowGeom->setVertexArray(vertex);
- vertex->push_back(osg::Vec3(600,600,0));
- vertex->push_back(osg::Vec3(600,400,0));
- nowGeom->setDataVariance(osg::Object::DYNAMIC);
- osg::StateSet* state2 = nowGeom->getOrCreateStateSet();
- osg::Point* point = new osg::Point;
- point->setSize(5.0);
- state2->setAttributeAndModes(point);
- state2->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
- geode->addDrawable(nowGeom);
复制代码 我将它设置成2个顶点确实可以看到两个顶点.
而修改成一个顶点的时候的即:- nowGeom->addPrimitiveSet(new osg::DrawArrays(GL_POINTS,0,1));
复制代码 应当是会绘制一个顶点的啊?可是却没有绘制出来?
如下图: 附件
而我在OpenGL里 使用glDrawArray(GL_POINTS,0,1)绘制一个顶点确实可以绘制的出来 |
|