Re: [osg-users] change material of a node but not its children

2008-10-17 Thread Vincent Bourdier
a little UP..

Sorry for the convenience, but I would be very useful to solve this problem
now...

Thanks.

Regards,
   Vincent.


2008/10/17 Vincent Bourdier <[EMAIL PROTECTED]>

> Hi,
>
> I'm currently on a problem :
>
> I change the color of a node (osg::PAT) but I don't want its child
> osg::text to have the same color...
>
> On the PAT I do a
>
> node->getOrCreateStateSet()->setAttributeAndModes(mat.get(),osg::StateAttribute::ON);
>
> On the text :
>
> osg::ref_ptr mat =
> (osg::Material*)text->getOrCreateStateSet()->getAttribute(osg::StateAttribute::MATERIAL);
> if(!mat.valid())
> mat = new osg::Material;
>
>
> mat->setAmbient(osg::Material::FRONT_AND_BACK,osg::Vec4(0.0,0.0,0.0,1.0));
>
> mat->setDiffuse(osg::Material::FRONT_AND_BACK,osg::Vec4(0.0,0.0,0.0,1.0));
>
> node->getOrCreateStateSet()->setAttributeAndModes(mat.get(),osg::StateAttribute::ON
> | osg::StateAttribute::PROTECTED);
>
>
> The text is in a geode, under the PAT.
>
>
> Any idea ? thanks a lot.
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] change material of a node but not its children

2008-10-17 Thread Vincent Bourdier
Hi,

I'm currently on a problem :

I change the color of a node (osg::PAT) but I don't want its child osg::text
to have the same color...

On the PAT I do a
node->getOrCreateStateSet()->setAttributeAndModes(mat.get(),osg::StateAttribute::ON);

On the text :

osg::ref_ptr mat =
(osg::Material*)text->getOrCreateStateSet()->getAttribute(osg::StateAttribute::MATERIAL);
if(!mat.valid())
mat = new osg::Material;


mat->setAmbient(osg::Material::FRONT_AND_BACK,osg::Vec4(0.0,0.0,0.0,1.0));

mat->setDiffuse(osg::Material::FRONT_AND_BACK,osg::Vec4(0.0,0.0,0.0,1.0));

node->getOrCreateStateSet()->setAttributeAndModes(mat.get(),osg::StateAttribute::ON
| osg::StateAttribute::PROTECTED);


The text is in a geode, under the PAT.


Any idea ? thanks a lot.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org