Not sure how that line got screwed up. I blame whatever flu I was coming down with on Friday :(
As for the override value, getOrCreateUniform() will call addUniform() if the uniform doesn't already exist. By default, addUniform sets the inheritance to ON (not OVERRIDE). I'm creating all my Texture2DEnabled uniforms this way, so they shouldn't be stomping on each other. I'd think the uniform state would be independent of the GL_TEXTURE_2D mode. In fact the whole reason I have that Texture2DEnabled uniform is so that my shader can tell whether or not there's any texture. AFAIK you can't examine the fixed pipe enable states from GLSL. Someone please clue me in if the way I'm doing this is idiotic. -Nathan -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dorosky, Christopher G Sent: Tuesday, April 01, 2008 9:54 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Uniforms and state sorting I think you had a typo in the second post. You meant: osg::StateSet* NewSS = new osg::StateSet; NewSS->setName("LightPoint state set"); NewSS->getOrCreateUniform("Texture2DEnabled", osg::Uniform::BOOL)->set(true); // this line got screwy. lpn->setStateSet(NewSS); Now given that, I am confused. Seems like some plain vanilla code. Is there some chance that "Override" is being set on a higher node? Can you override uniform values? What about if Texture2D is overridden off not as a uniform? Chris -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Monteleone, Nathan Sent: Friday, March 28, 2008 10:22 AM To: OpenSceneGraph Users Subject: [osg-users] Uniforms and state sorting My first try didn't seem to go through so I'm sending it again. My apologies if this turns out to be a double post. I'm having a problem where I want to pass a particular Uniform to a fragment shader for all the point lights in my model. Basically I read the model using the .flt loader, find all the LightPointNodes using a visitor, and then: (for each light point node "lpn") lpn->setPointSprite(); // Because GL_POINT_SMOOTH w/shaders freaks out on ATI // Do some stuff to set up the point sprite texture osg::StateSet* NewSS = new osg::StateSet; NewSS->setName("LightPoint state set"); NewSS->getOrCreateUniform("Texture2DEnabled", NewSS->osg::Uniform::BOOL)->set(true); lpn->setStateSet(NewSS); I'm not running any optimizers after doing this. I know I eventually should to get rid of all the redundant state sets but I'm trying to debug it right now... But the uniform value that shows up in my shader is inconsistent. Sometimes it'll be applied as true, sometimes as false, and it's dependent on what other things are in the scene. Looks like a lazy state error basically. Anything jump out that I might be doing wrong? Do uniforms have some "override" feature similar to other state attributes that I'm not accounting for? I am using an old version -- OSG 1.2. We're planning to upgrade soon but it's a big app so we have to be cautious about that sort of thing :( Thanks, Nathan _______________________________________________ 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.or g _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

