[osg-users] what should I dirty when I change ColorArray on the fly?

Claudio Benghi claudio.benghi at gmail.com
Mon Oct 14 14:17:49 PDT 2019


Hello All,

I have implemented a colour change visitor along the lines of the class found at:
http://www.vis-sim.com/osg/code/osgcode_color1.htm

While debugging I note that the following code is executed, including the colorArrays->dirty(), but the colour in the render is not affected.

Could it depend from the way in which the colorArray is initialliy instantiated? 
Should I mark some state as Dynamic?


Code:

void XbimNodeColorVisitor::apply(osg::Geometry &curGeom)
{
  osg::Vec4Array *colorArrays = dynamic_cast<osg::Vec4Array *>(curGeom.getColorArray());
  if (colorArrays) {
    for (unsigned int i = 0; i < colorArrays->size(); i++) {
      osg::Vec4 *color = &colorArrays->operator [](i);
      color->set(m_color._v[0], m_color._v[1], m_color._v[2], m_color._v[3]);
    }
    colorArrays->dirty();
  }
  else {
    // code never enters this path
  }
}



 

Thank you!

Cheers,
Claudio

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







More information about the osg-users mailing list