|
楼主 |
发表于 2011-6-30 15:47:24
|
显示全部楼层
本帖最后由 water_GIS 于 2011-6-30 15:49 编辑
回复 2# 朽木
谢谢,问题解决了,用的BlendFun函数.
osg::StateSet* stateset = geom->getOrCreateStateSet();
stateset->setMode( GL_LIGHTING, osg::StateAttribute::OFF |
osg::StateAttribute::PROTECTED);
//打开融合模式(以保证ALPHA纹理正确)
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
//禁止深度测试,几何体忽略已绘制物体的深度值
stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
stateset->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );
osg::BlendColor *bc=new osg::BlendColor(osg::Vec4(1.0,0,0,0));
osg::BlendFunc * bf=new osg::BlendFunc();
stateset->setAttributeAndModes(bf,osg::StateAttribute::ON);
stateset->setAttributeAndModes(bc,osg::StateAttribute::ON);
bf->setSource(osg::BlendFunc::CONSTANT_ALPHA);
bf->setDestination(osg::BlendFunc::ONE_MINUS_CONSTANT_ALPHA);
bc->setConstantColor(osg::Vec4(1, 1, 1,0.4f)); |
|