|
我用以下代码加载模型church.osg时,显示的是线框模型
osgViewer::Viewer viewer;
- //load data
- osg::ref_ptr<osg::Group> root = new osg::Group;
- osg::ref_ptr<osg::Node> church = osgDB::readNodeFile("church.osg");
- //display
- root->addChild(church.get());
- viewer.setSceneData(root.get());
- return viewer.run();
复制代码
我想用以下代码将其改成填充的多边形模式,但是不知为何没有效果???还请哪位高手指点一下,模型在附件中
- //set state
- osg::StateSet* stateChurch = church->getOrCreateStateSet();
- osg::ref_ptr<osg::PolygonMode> polygonMode = new osg::PolygonMode(
- osg::PolygonMode::FRONT, osg::PolygonMode::FILL);
- stateChurch->setAttributeAndModes(polygonMode);
复制代码 |
-
-
church.zip
989.26 KB, 下载次数: 8, 下载积分: 威望 1
解压后为church.osg
|