|
楼主 |
发表于 2008-9-10 15:14:06
|
显示全部楼层
原帖由 FlySky 于 2008-9-10 12:17 发表
得到并设置属性,,使用混合(GL_ALPHA )~~~~
还是不透明啊,代码如下:- osg::ref_ptr <osg::Geode> geode3 = new osg::Geode ;
- //画圆锥
- shape = new osg::ShapeDrawable(new osg::Cone(osg::Vec3(0.0f, 0.0f, 2.5f), radius*2, 1.0), hints.get());
- shape->setColor(osg::Vec4(1.0f, 1.0f, 1.0f, 0.1f)); //设置颜色
- geode3->addDrawable(shape.get());
- osg::StateSet* state = geode3->getOrCreateStateSet();
- osg::ref_ptr<osg::Material> mat = new osg::Material;
- //漫反射光(决定物体颜色)
- mat->setDiffuse( osg::Material::FRONT,
- osg::Vec4( 1.f, 1.f, 1.f, 0.f ) );
- //镜面反射光
- mat->setSpecular( osg::Material::FRONT,
- osg::Vec4( 1.f, 1.f, 1.f, 0.f ) );
- //环境反射光
- mat->setShininess( osg::Material::FRONT, 128.f );
- //设置透明度
- mat->setTransparency(osg::Material::FRONT,0.0f);
- mat->setTransparency(osg::Material::BACK,0.0f);
- state->setAttribute( mat.get() );
- state->setMode(GL_ALPHA,osg::StateAttribute::ON);
复制代码 问题出在哪呢? |
|