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

Trajce Nikolov NICK trajce.nikolov.nick at gmail.com
Mon Oct 14 20:14:14 PDT 2019


Hi Claudio,

it depends how your Geometry is setup. You might need to call
osg::Geometry->dirtyDisplayList() or if you use VertexBufferObjects you
might need to call colorArrays->getBufferObject()->dirty()

On Mon, Oct 14, 2019 at 11:16 PM Claudio Benghi <claudio.benghi at gmail.com>
wrote:

> 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
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


-- 
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20191015/5396189d/attachment.html>


More information about the osg-users mailing list