Another way to you could do this is you want to keep the program around to reuse later
Is to remove the shaders from the program m_rvShadeProgram->removeShader(m_mainVertexShader) To re-enable do m_rvShadeProgram->AddShader(m_mainVertexShader) This works nice for our usage, note you will need to start the m_mainVertexShader with a reference count of 1 before do the first add.. More than one way to skin a cat as the saying goes ;) Gordon __________________________________________________________ Gordon Tomlinson Email : gtomlinson @ overwatch.textron.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Art Tevs Sent: Thursday, August 28, 2008 5:14 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Disable Shader You can also just add an empty program to the StateSet. Something like this: ss->setAttributeAndModes(new osg::Program()); This will bind a program object which will call glUseProgram(0) on the next apply, which is in fact the same as disable a shader program. Cheers, art --- Robert Osfield <[EMAIL PROTECTED]> schrieb am Do, 28.8.2008: > Von: Robert Osfield <[EMAIL PROTECTED]> > Betreff: Re: [osg-users] Disable Shader > An: "OpenSceneGraph Users" <[email protected]> > Datum: Donnerstag, 28. August 2008, 10:57 Hi Christian, > > Unfortunately you can disable GLSL programs (shaders), as OpenGL > itself doesn't support glEnable/glDisable of GLSL programs. If you > wish to toggle between the fixed function pipeline and using a GLSL > program then you have to remove the Program i.e. > > ss->removeAttribute(m_program.get()); > > Robert. > > On Thu, Aug 28, 2008 at 9:31 AM, > <[EMAIL PROTECTED]> wrote: > > > > Hi! > > > > I have a short question about Shaders: How can I > disable a Shader? > > > > osg::StateSet* ss = m_pNode->getOrCreateStateSet(); > > ss->setAttributeAndModes(m_program.get(), > osg::StateAttribute::OFF); > > > > Does not work, even if I set it for the first time. > > Where is the trick? > > > > Thanks in advance, > > Christian > > > > _______________________________________________ > > 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 __________________________________________________ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com _______________________________________________ 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

