Mihai Radu wrote:
I have also ran into this kind of problem moving from 1.0 to 1.2
(osgProducer).
The set-up is similar, a uniform with default value at the root group:
root->getOrSetStateSet()-> addUniform(new Uniform("uTextured",true))
then nodes can have this overridden:
node->getOrSetStateSet()-> addUniform(new Uniform("uTextured",false))
The problem is that in some cases the node will not use the custom
value of the uniform when it's being drawn. The frustrating part is
that this appears sometimes based on the viewing direction of the
camera in the scene (when using a bunch of nodes with the custom
Uniform added to them).
Yep this is exactly what we observe. And, it *was* working fine in 1.0.
For example, we have a vertex/fragment shader that's essentially:
// vertex:
void main(void)
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}
// fragment:
uniform sampler2D tex;
uniform bool nodeHasTexture;
void main()
{
vec4 fragColor;
if (nodeHasTexture)
{
vec2 texCoord = gl_TexCoord[0].st;
fragColor = texture2D(tex, texCoord);
}
else
fragColor = vec4(1,0,0,1); // red
gl_FragColor = fragColor;
}
where nodeHasTexture is an osg::Uniform=true at root of scene graph
where the osg::Program is attached, and some textureless nodes set it to
false. If those nodes do not touch the value (leave it true), the "bug"
effect is not observed.
I realize the standard answer is to move to the new viewer code, but
that is not an option for some of our projects since they are close to
delivery and we can't use an unstable code-base for that. Maybe
Same here.
As far as providing some code for illustration, I couldn't reproduce
it with a simple example, and the application is too tightly
integrated with the physics engine to provide some code samples that
make sense.
Same problem here. We'll have to earmark some funds in the next phase of
our project for figuring out the problem since eventually we will want
to move up to 1.2, we're just lucky it is not critical right now.
Oliver
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/