Hi,

I am trying to update a code that was working on 3.1.2. A osg::Node is loaded 
from a stl file using osgDB::readNodeFile. 
The Node is a Group with one Geode with one geometry.
There is a problem with the colors. The only code difference between osg 3.2.0 
and osg 3.1.2 is where I set the colors:


Code:

void Mesh::setColor(osg::Vec4 color) {
#if OSG_VERSION_GREATER_OR_EQUAL(3, 2, 0)
        osg::Geometry* geometry = 
meshNode_->asGroup()->getChild(0)->asGeode()->getDrawable(0)->asGeometry();
        osg::Vec4Array* colors = new osg::Vec4Array;
        colors->push_back(color);
        colors->setBinding(osg::Array::BIND_OVERALL);
        geometry->setColorArray(colors);
#else
        osg::Geometry* geometry = 
this->meshNode_->asGeode()->getDrawable(0)->asGeometry();
        osg::Vec4Array* colors = new osg::Vec4Array;
        colors->push_back(color);
        geometry->setColorArray(colors);
        geometry->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE_SET);
#endif
        
}



The result I get are shown in the pictures attached. Do you have any idea where 
this could come from?

Thank you!

Cheers,
alexis

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=58826#58826




Attachments: 
http://forum.openscenegraph.org//files/osg312_109.png
http://forum.openscenegraph.org//files/osg320_786.png


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to