Hi,
I'm trying to update trasparency of a matrix transform in un update callback,
using osg::stateSet and osg::Material. Here is the code:
osg::MatrixTransform* transf = (osg::MatrixTransform*) node;
osg::StateSet* state =
transf->getOrCreateStateSet();
state->setMode(GL_BLEND,osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
osg::Material* mat = new osg::Material;
mat->setAlpha(osg::Material::FRONT_AND_BACK, alpha);
//mat->setTransparency(osg::Material::FRONT_AND_BACK,1);
state->setAttributeAndModes(mat,osg::StateAttribute::ON |
osg::StateAttribute::OVERRIDE);
osg::BlendFunc* bf = new
osg::BlendFunc(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA );
state->setAttributeAndModes(bf);
state->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
state->setMode(GL_LIGHTING,
osg::StateAttribute::OFF);
Now the problem is that these code isn't working with some models. For example
if i use it with the cow.osg model it works, but if I use it with axes.osg it
isn't working...Have you got any ideas about the cause of this strange problem?
Thank you!
Cheers,
Antonio
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50578#50578
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org