Hi Christophe,
You can do one of these:
1) Create a shader. You can give either vertices or pixels an alpha value
easily. You'll have to read up on GLSL for this.
2) Add a material to the top of the node's hierarchy, and then apply alpha
values to it.
//Make sure blending is on.
stateSet->setMode( GL_BLEND,
osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON );
//Get the material if it exists
osg::Material* material = (osg::Material*)stateSet->getAttribute(
osg::StateAttribute::MATERIAL
);
if ( material == NULL ){
//Material hasn't been allocated yet.
material = new osg::Material;
}
material->setAlpha( osg::Material::FRONT_AND_BACK, alpha );
if ( m_fAlpha >= 1.0f ){
//Entity is opaque so turn off state attribute
stateSet->setAttributeAndModes( material,
osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF );
}else{
//Entity has transparency
stateSet->setAttributeAndModes( material,
osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON );
}
Zach
_____
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of christophe
loustaunau
Sent: Wednesday, April 18, 2007 08:46
To: osg users
Subject: [osg-users] transparency on a node
Hello !
I have some questions about transparency.
I load a file (ive) into a node, and then i wan't this node to be more and
more transparent.
I think i can do this with blending and the value of alpha. But we can't do
a
setcolor(r,g,b,a), on a node, so..
Next i have look the nodeMask. with it i could hide the node completely but
not progressivly.
I someone have an idea how doing this it will be helpfull.
thanks
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/