Re: [osg-users] what should I dirty when I change ColorArray on the fly?
Hi Nick, indeed, that works. Thank you, Claudio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76833#76833 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] what should I dirty when I change ColorArray on the fly?
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 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 ) > { > osg::Vec4Array *colorArrays = dynamic_cast *>(curGeom.getColorArray()); > if (colorArrays) { > for (unsigned int i = 0; i < colorArrays->size(); i++) { > osg::Vec4 *color = >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@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] what should I dirty when I change ColorArray on the fly?
Hi again, I think I've solved my issue. I've worked out that BufferObject::dirty() does not yield a result because _glBufferObjects[i].valid() is false. This is probably because I was not using VBOs on those geometries. If I create the geometry with setUseVertexBufferObjects(true) the code works. Otherwise I've found that curGeom.dirtyDisplayList(); updates the geometry if setUseVertexBufferObjects() is not invoked. Just writing it here in case it helps somebody else. Thank you! Cheers, Claudio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76830#76830 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] what should I dirty when I change ColorArray on the fly?
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 ) { osg::Vec4Array *colorArrays = dynamic_cast(curGeom.getColorArray()); if (colorArrays) { for (unsigned int i = 0; i < colorArrays->size(); i++) { osg::Vec4 *color = >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@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] what should I dirty when I change ColorArray on the fly?
yes :) .. Thanks Glenn .. I totally missed that On Wed, May 3, 2017 at 8:54 PM, Glenn Waldronwrote: > Nick, > If you have VBOs enabled, I think you just have to call dirty() on the > color array itself. > > > Glenn Waldron > > On Wed, May 3, 2017 at 2:43 PM, Trajce Nikolov NICK < > trajce.nikolov.n...@gmail.com> wrote: > >> Hi community, >> >> this is simple question. I am updating the Color array of a osg::Geometry >> on the fly. It is not having effect. The Geometry is not using displaylist. >> How/What should I do to have the color mods "updated" in the rendering >> correctly? >> >> Thanks a bunch as always? >> >> -- >> trajce nikolov nick >> >> ___ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] what should I dirty when I change ColorArray on the fly?
Nick, If you have VBOs enabled, I think you just have to call dirty() on the color array itself. Glenn Waldron On Wed, May 3, 2017 at 2:43 PM, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > Hi community, > > this is simple question. I am updating the Color array of a osg::Geometry > on the fly. It is not having effect. The Geometry is not using displaylist. > How/What should I do to have the color mods "updated" in the rendering > correctly? > > Thanks a bunch as always? > > -- > trajce nikolov nick > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] what should I dirty when I change ColorArray on the fly?
Hi community, this is simple question. I am updating the Color array of a osg::Geometry on the fly. It is not having effect. The Geometry is not using displaylist. How/What should I do to have the color mods "updated" in the rendering correctly? Thanks a bunch as always? -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org