Hi, At my work we use OSG for simulation purposes and I am looking to display a model with each of its individual parts/components displayed in a different color.
I am new to OSG so I still dont understand everything yet. But I know I need to remove all of the skins and apply a new color. A co-worker already created a way to give the entire model a color but I need to do it for each sub component. Here is the function my co-worker has used to remove the textures and add the new material. Code: void removeTextures(osg::Node* x) { if(x != nullptr) { auto state = x->getOrCreateStateSet(); state->setAttributeAndModes(this->material, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON); state->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF); auto group = x->asGroup(); if(group != nullptr) { auto numChildren = group->getNumChildren(); for(decltype(numChildren) i = 0; i < numChildren; i++) { this->removeTextures(group->getChild(i)); } } } } How would I go about changing the material of each geode/geometry/drawable and what are the differences between these three classes? Thank you! Cheers, Daniel ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=68032#68032 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org