osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
geom->setSupportsDisplayList(false);
geode->addDrawable(geom.get());
osg::ref_ptr<osg::Vec3Array> vArr = new osg::Vec3Array;
vArr->push_back(osg::Vec3(-5.0f,0.0f,-5.0f));
vArr->push_back(osg::Vec3(5.0f,0.0f,-5.0f));
vArr->push_back(osg::Vec3(5.0f,0.0f,5.0f));
vArr->push_back(osg::Vec3(-5.0f,0.0f,5.0f));
geom->setVertexArray(vArr.get());
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
osg::ref_ptr<osg::Vec3Array> nArr = new osg::Vec3Array;
nArr->push_back(osg::Vec3(0.0, 0.0, 1.0));
geom->setNormalArray(nArr.get());
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
osg::ref_ptr<osg::Vec4Array> cArr = new osg::Vec4Array;
cArr->push_back(osg::Vec4(1.0,1.0,0.0,1.0));
ge
osg学习(六十一)osg着色器例子
最新推荐文章于 2024-05-05 22:58:07 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)