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.org

Reply via email to