Mike, Thanks for the reply. There was an exchange on this subject back on August 28 in the archives. I tried all the suggested solutions to the problem to no avail. I have tried binding to an "empty" program as you suggest by using the call ss->SetAttributesAndModes(new osg::Program()) which does indeed turn off the shader (back to fixed functionality). But when I attempt to switch back to the shader with another call to ss->SetAttributesAndModes(MyShaderProgram), it crashes my OpenSceneGraph app.
I've tried the other suggestions such as removing the shaders from the program and then adding them back on for enable/disable and also the call ss->RemoveAttribute(MyShaderProgram) which have also caused a crash on the ensuing call ss->SetAttributesAndModes(MyShaderProgram). The only mechanism that has worked cleanly for me is if I create two programs, one that is empty and one that has my vertex/fragment shaders attached. When I call each programs "apply" method to switch the shaders off and on, this seems to work. I'm not sure if this the correct way to do it though. I've also noticed that there is no clean way of switching between multiple programs attached to a single object during runtime. At least I haven't found a way to get it to work in OSG. In OpenGL, I've always been able to have multiple programs that I can swap in and out via the call to glUseProgram() with the appropriate program handle (including the call glUseProgram(0) to switch to the fixed pipe). I don't see an equivalent mechanism in OpenSceneGraph to achieve the same functionality. If you or anyone else can enlighten me, it would be most appreciated... -Shayne -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Weiblen Sent: Thursday, November 13, 2008 11:33 AM To: OpenSceneGraph Users Subject: Re: [osg-users] shaders in OSG... The only way to turn off a glProgram in GL is glUseProgram(0), there is no glEnable/glDisable. In OSG you do that by creating an "empty" osg::Program, one with no osg::Shaders attached. Just attach that empty osg::Program where you want to revert to fixed-function. Further details in http://mew.cx/osg_glsl_july2005.pdf cheers -- mew On Wed, Nov 12, 2008 at 2:55 PM, Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC <[EMAIL PROTECTED]> wrote: > Hello, > > > > Is there a "light weight" way to turn off shaders in OSG without unloading > the vertex and fragment shaders from the shader program? > > > > My application needs to switch back and forth from the shader pipeline to > the fixed pipeline and vice versa during runtime. This can be done at the > OpenGL level by calling the function glUseProgramObject() to make the quick > switch. Is there an equivalent in OpenSceneGraph? > > > > Thanks in advance, > > -Shayne > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- Mike Weiblen -- Boulder Colorado USA -- http://mew.cx/ _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org