[osg-users] Transparency on a drawable

Vincent Bourdier vincent.bourdier at gmail.com
Fri Jul 11 05:54:07 PDT 2008


No one have any idea of how to set an alpha transparency level on a geometry
?
It has no texture, juste one color...

Thanks,

Regards,

Vincent.

2008/7/11 Vincent Bourdier <vincent.bourdier at gmail.com>:

> Hi All,
>
> Just a simple question on how to set a transparency effect on a drawable.
>
> My geode contains 2 drawables, and I need only one to be transparent...
>
> I've tried :
>
> double opacity = 0.1;
>>
>>     osg::StateSet* state = mygometry->getOrCreateStateSet();
>>
>> state->setMode(GL_BLEND,osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
>>     osg::Material* mat =
>> (osg::Material*)state->getAttribute(osg::StateAttribute::MATERIAL);
>>     if(!mat) {
>>         mat = new osg::Material;
>>         mat->setAlpha(osg::Material::FRONT_AND_BACK, opacity);
>>         state->setAttributeAndModes(mat,osg::StateAttribute::ON);
>>     }
>>
>
> Lightning is already set to ON...
>
> But nothing appear transparent...
>
> Thanks,
>
> Regards
>     Vincent.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080711/17da0a68/attachment-0003.htm>


More information about the osg-users mailing list