|
如题,需要将同一个shader用于某个物体,然后关闭,激活,达到一闪一闪的效果,
- if (!shadered)
- {
- cow->getOrCreateStateSet()->setAttributeAndModes(program_current,osg::StateAttribute::ON);
- shadered = true;
- }
- else
- {
-
- cow->getOrCreateStateSet()->setAttributeAndModes(program_current,osg::StateAttribute::OFF);
- shadered = false;
- }
复制代码
cow->getOrCreateStateSet()->setAttributeAndModes(program_current,osg::StateAttribute::OFF);
测试使用这种方法不成功
使用remove的方法,在几次闪烁后会报内存错误 |
|