Hi Louis,
Is the "shaderprogram" variable an osg::ref_ptr<osg::Program> or is it a
osg::Program*?  If it is not an osg::ref_ptr<osg::Program>, the
reference count is going to zero in the removeAttribute method, and the
object is being deleted.  I had the same issue a while back.
Hope this helps,
Justin


-----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.or
g
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to