Thanks for help.<br><br>I do exactly the same things, on Nodes...<br><br>but this time I am looking on a way to do this only on a geometry (So under a Geode)...<br><br>If you have any suggestion..<br><br>Regards,<br><br>Vincent<br>
<br><br><div class="gmail_quote">2008/7/11 Brian R Hill <<a href="mailto:bhill22@csc.com">bhill22@csc.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
This is what I do:<br>
<br>
osg::StateSet * stateset = node->getOrCreateStateSet();<br>
osg::Material * mm = dynamic_cast<osg::Material*>(stateset->getAttribute<br>
(osg::StateAttribute::MATERIAL));<br>
if (!mm)<br>
{<br>
 mm = new osg::Material;<br>
}<br>
mm->setAlpha(osg::Material::FRONT, transparency);<br>
stateset->setAttributeAndModes( mm, osg::StateAttribute::OVERRIDE |<br>
osg::StateAttribute::ON);<br>
stateset->setMode(GL_BLEND,   osg::StateAttribute::OVERRIDE |<br>
osg::StateAttribute::ON );<br>
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE |<br>
osg::StateAttribute::ON );<br>
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);<br>
<br>
Brian<br>
-----<a href="mailto:osg-users-bounces@lists.openscenegraph.org">osg-users-bounces@lists.openscenegraph.org</a> wrote: -----<br>
<br>
<br>
To: "'OpenSceneGraph Users'" <<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>><br>
From: "Gordon Tomlinson" <<a href="mailto:gordon.tomlinson@sensor.com">gordon.tomlinson@sensor.com</a>><br>
Sent by: <a href="mailto:osg-users-bounces@lists.openscenegraph.org">osg-users-bounces@lists.openscenegraph.org</a><br>
Date: 07/11/2008 09:59AM<br>
<div><div></div><div class="Wj3C7c">Subject: Re: [osg-users] Transparency on a drawable<br>
<br>
<br>
Vincent<br>
You post your initial question at a little over 2 hours ago.. you need to<br>
give people time to possibly respond maybe 1-2 days<br>
<a href="http://www.catb.org/%7Eesr/faqs/smart-questions.html" target="_blank">http://www.catb.org/~esr/faqs/smart-questions.html</a><br>
also a search of the mailing list archive will throw up quite a few<br>
discussions and solutions on this very subject<br>
<br>
<br>
<br>
<br>
From: <a href="mailto:osg-users-bounces@lists.openscenegraph.org">osg-users-bounces@lists.openscenegraph.org</a><br>
[mailto:<a href="mailto:osg-users-bounces@lists.openscenegraph.org">osg-users-bounces@lists.openscenegraph.org</a>] On Behalf Of Vincent<br>
Bourdier<br>
Sent: Friday, July 11, 2008 8:54 AM<br>
To: osg<br>
Subject: Re: [osg-users] Transparency on a drawable<br>
<br>
<br>
No one have any idea of how to set an alpha transparency level on a<br>
geometry ?<br>
It has no texture, juste one color...<br>
<br>
Thanks,<br>
<br>
Regards,<br>
<br>
Vincent.<br>
<br>
<br>
2008/7/11 Vincent Bourdier < <a href="mailto:vincent.bourdier@gmail.com">vincent.bourdier@gmail.com</a> >:<br>
<br>
Hi All,<br>
<br>
Just a simple question on how to set a transparency effect on a drawable.<br>
<br>
My geode contains 2 drawables, and I need only one to be transparent...<br>
<br>
I've tried :<br>
<br>
<br>
double opacity = 0.1;<br>
<br>
    osg::StateSet* state = mygometry->getOrCreateStateSet();<br>
    state->setMode(GL_BLEND,osg::StateAttribute::ON|<br>
    osg::StateAttribute::OVERRIDE);<br>
    osg::Material* mat = (osg::Material*)state->getAttribute<br>
    (osg::StateAttribute::MATERIAL);<br>
    if(!mat) {<br>
        mat = new osg::Material;<br>
        mat->setAlpha(osg::Material::FRONT_AND_BACK, opacity);<br>
        state->setAttributeAndModes(mat,osg::StateAttribute::ON);<br>
    }<br>
<br>
<br>
Lightning is already set to ON...<br>
<br>
But nothing appear transparent...<br>
<br>
Thanks,<br>
<br>
Regards<br>
    Vincent.<br>
<br>
<br>
</div></div><div><div></div><div class="Wj3C7c">_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</div></div></blockquote></div><br>