|
请问各位大哥:
1.在Quick Guide一书中State例子中。
无论使用 state->setAttributeAndModes(pm) 还是state->setAttribute( pm );程序运行之后 效果都是一样的。见附图
那什么时候使用前者,什么时候使用后者呢,两者到底有什么不同呢?
2. 根据这两个函数的头文件介绍,setAttributeAndModes 默认是开启的,setAttribute 默认是关闭的,为何两者效果一样呢?
求详解!
/** Set this StateSet to contain specified attribute and override flag.*/
void setAttribute(StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF);
/** Set this StateSet to contain specified attribute and set the associated GLMode's to specified value.*/
void setAttributeAndModes(StateAttribute *attribute, StateAttribute::GLModeValue value=StateAttribute::ON);
- osg::StateSet* state = mt->getOrCreateStateSet();
- osg::PolygonMode* pm = new osg::PolygonMode(
- osg::PolygonMode::FRONT_AND_BACK,
- osg::PolygonMode::LINE );
- // state->setAttributeAndModes( pm );
- state->setAttribute( pm );
复制代码 |
|