[osg-users] Transparency on a drawable

Vincent Bourdier vincent.bourdier at gmail.com
Fri Jul 11 08:25:22 PDT 2008


Thanks for help.

I do exactly the same things, on Nodes...

but this time I am looking on a way to do this only on a geometry (So under
a Geode)...

If you have any suggestion..

Regards,

Vincent


2008/7/11 Brian R Hill <bhill22 at csc.com>:

> This is what I do:
>
> osg::StateSet * stateset = node->getOrCreateStateSet();
> osg::Material * mm = dynamic_cast<osg::Material*>(stateset->getAttribute
> (osg::StateAttribute::MATERIAL));
> if (!mm)
> {
>  mm = new osg::Material;
> }
> mm->setAlpha(osg::Material::FRONT, transparency);
> stateset->setAttributeAndModes( mm, osg::StateAttribute::OVERRIDE |
> osg::StateAttribute::ON);
> stateset->setMode(GL_BLEND,   osg::StateAttribute::OVERRIDE |
> osg::StateAttribute::ON );
> stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE |
> osg::StateAttribute::ON );
> stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
>
> Brian
> -----osg-users-bounces at lists.openscenegraph.org wrote: -----
>
>
> To: "'OpenSceneGraph Users'" <osg-users at lists.openscenegraph.org>
> From: "Gordon Tomlinson" <gordon.tomlinson at sensor.com>
> Sent by: osg-users-bounces at lists.openscenegraph.org
> Date: 07/11/2008 09:59AM
> Subject: Re: [osg-users] Transparency on a drawable
>
>
> Vincent
> You post your initial question at a little over 2 hours ago.. you need to
> give people time to possibly respond maybe 1-2 days
> http://www.catb.org/~esr/faqs/smart-questions.html<http://www.catb.org/%7Eesr/faqs/smart-questions.html>
> also a search of the mailing list archive will throw up quite a few
> discussions and solutions on this very subject
>
>
>
>
> From: osg-users-bounces at lists.openscenegraph.org
> [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Vincent
> Bourdier
> Sent: Friday, July 11, 2008 8:54 AM
> To: osg
> Subject: Re: [osg-users] Transparency on a drawable
>
>
> 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.
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080711/9ee32e88/attachment-0003.htm>


More information about the osg-users mailing list