I would guess it is a reference count issue if you want to add and remove and keep a reference counted object then you could call ::ref() on the object when you create it or use the preferred method of using a variable an osg::ref_ptr<object> to preserve the scope of the object
__________________________________________________________ Gordon Tomlinson [EMAIL PROTECTED] IM: [EMAIL PROTECTED] www.vis-sim.com www.gordontomlinson.com __________________________________________________________ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Louis Bouchard Sent: Wednesday, August 27, 2008 5:52 PM To: [email protected] Subject: [osg-users] Fwd: Strange stateset / shader problem Hi, since we cannot turn off a shader program like this: setAttributeAndModes(shaderprogram, osg::StateAttribute::OFF) .. I tried the suggested method from this post (http://www.mail-archive.com/[EMAIL PROTECTED]/msg08493.html), and I simply removeAttribute(...) the shader from the stateset. This part works quite well. However, if I want to turn it back on again, setAttributeAndModes(shaderprogram, osg::StateAttribute::ON) produces a segmentation fault. I have no idea why. The shaderprogram pointer is still valid. I ran this through gdb and it was unhelpful. any ideas? thanks, Louis Bouchard _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

