Hi Dieter,

Dieter Pfeffer wrote:
I supposed that it has s.th to do with the missing material paramters; my
idea was to change the original material of the node, therefore I set:

osg::StateSet *ss = loadedModel ->getOrCreateStateSet();
osg::Material* blendMaterial = 
(osg::Material*)(ss->getAttribute(osg::StateAttribute::MATERIAL));

but the material is always NULL so I don't have the original material
>
> Is this the wrong function call ?

The function call is correct, you're probably looking in the wrong spot ;-)

I assume 'loadedModel' is the Node returned from 'readNodeFile'?
If this is the case than most likely this is only a Group node that contains the rest of the scene graph. If you take a look at e.g. 'cow.osg' (or most of the examples) you'll see that the Material isn't actually attached to the top node.

What you'll need to do is traverse the scene graph and find the Material node(s) you're looking for. For example you could look for a Node with a certain name and fetch it's Material. Also keep in mind that Materials are attached to StateSets which may be attached to Nodes *or* Drawables (attached to Geodes).

Cheers!
/ulrich
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to