Hello everyone,
Im dont come any further, trying to change transparency of on object at
runtime.
I have something like this:
The stateset in a method:
this->material = new osg::Material();
this->material->setDataVariance(osg::Object::DYNAMIC);
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet();
stateset->setDataVariance(osg::Object::DYNAMIC);
// set up the texture.
osg::Texture2D* texture = new osg::Texture2D;
texture->setImage(image);
stateset->setTextureAttributeAndModes(0,
texture,osg::StateAttribute::ON);
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
stateset->setAttributeAndModes(this->material.get(),osg::StateAttribute:
:OVERRIDE|osg::StateAttribute::ON);
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
The stateset is then applied to a geode once.
And in another mehtod after viewer is running and object is shown:
this->material->setTransparency(osg::Material::Face::FRONT_AND_BACK,valu
e);
This method is called continuesly with different float values between 0
and 1 depending an GUI Slider.
But I cant see any changes.
Do you have some hints maybe?
Greetings Hagen
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org