What I'm doing is to transfer a Boolean uniform variable to the GLSL Then if I want to turn on the shader, I set the Boolean true, and false otherwise. In the shader, I check the Boolean to see what to do, if true, do the shading, otherwise, I just implement the fix-functionality. And this works fine so far. Hope it helps.
---- Original Message ----- 发件人: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 代表 Zach Deedler 发送时间: Tuesday, January 09, 2007 12:58 AM 收件人: 'osg users' 主题: RE: [osg-users] StateSet issue Hi Robert, Oops, this is what I meant SCENE Parent->Program with shader Child->Empty program PROBLEM Child was still being shaded. Zach -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield Sent: Monday, January 08, 2007 11:39 To: osg users Subject: Re: [osg-users] StateSet issue Hi Zach, The osg::Program used should be empty - i.e. no shaders attached. Robert. On 1/8/07, Zach Deedler <[EMAIL PROTECTED]> wrote: > This might be more readable as the problem: > > SCENE > Parent->Shader > Child->Shader with empty program > > PROBLEM > Child was still being shaded. > > > Zach > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of David > Guthrie > Sent: Monday, January 08, 2007 11:12 > To: osg users > Subject: Re: [osg-users] StateSet issue > > Oh, if you need it to work, just create an osg::Program and pass it to > the state set without doing anything else. The program will be empty > and it will disable the shaders. I've never coded that in an osg file, though. > > > > On Jan 8, 2007, at 11:08 AM, Zach Deedler wrote: > > > I agree. (since I haven't been able to get the empty osg::Program > > thing to > > work) > > > > > > Zach > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of David > > Guthrie > > Sent: Monday, January 08, 2007 11:00 > > To: osg users > > Subject: Re: [osg-users] StateSet issue > > > > It might be a nice feature if OSG supported doing this, that is one > > could turn off shaders and it would assign an empty program but hold > > onto the last program. Then it could be turned back on again. As > > often as people have this problem, it could be nice to work around it. > > > > My two cents, > > David > > > > On Jan 8, 2007, at 10:47 AM, Robert Osfield wrote: > > > >> Hi Joakim, > >> > >> Unfortunately you can't turn GLSL shaders off using a mode change > >> as OpenGL itself doesn't support this for GLSL. This is a real > >> shame w.r.t consistency with the rest of the OSG/OpenGL. The way > >> to switch off shaders is to assign an empty osg::Program to the > >> stateset that you don't want GLSL to be active on. > >> > >> Robert. > >> > >> On 1/8/07, Joakim Simonsson <[EMAIL PROTECTED]> wrote: > >>> > >>> Hi, > >>> > >>> * I have one group that contains two geodes, A and B. > >>> * The group has a StateSet with a shader. > >>> * My goal is to modify the StateSet of geode B, so the shader > >>> doesn't apply for that node. > >>> > >>> B's state set: > >>> > >>> StateSet { > >>> UniqueID StateSet_2 > >>> DataVariance STATIC > >>> rendering_hint DEFAULT_BIN > >>> renderBinMode INHERIT > >>> 0x24 OFF This should turn shaders > >>> off > >>> } > >>> > >>> But it seems that it still inherits the stateset from the parent > >>> node (the group node), i.e. the shader is not turned off for the B > >>> node. > >>> > >>> Any clues? > >>> > >>> > >>> -- > >>> Joakim Simonsson > >>> > >>> _______________________________________________ > >>> osg-users mailing list > >>> [email protected] > >>> http://openscenegraph.net/mailman/listinfo/osg-users > >>> http://www.openscenegraph.org/ > >>> > >>> > >>> > >> _______________________________________________ > >> osg-users mailing list > >> [email protected] > >> http://openscenegraph.net/mailman/listinfo/osg-users > >> http://www.openscenegraph.org/ > >> > > > > _______________________________________________ > > osg-users mailing list > > [email protected] > > http://openscenegraph.net/mailman/listinfo/osg-users > > http://www.openscenegraph.org/ > > > > _______________________________________________ > > osg-users mailing list > > [email protected] > > http://openscenegraph.net/mailman/listinfo/osg-users > > http://www.openscenegraph.org/ > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ > > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ > _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/ _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/ _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
