Hi Karl, On 6/08/11 3:53 , Cary, Karl A. wrote: > I have a geode that loads a shader. It loads up a texture that is meant to be > a default > texture. That geode then has many children drawables under it. The plan is > that each child > will have a different texture associated with it, but will otherwise be using > the same > shader and StateSet as the parent geode. If the child does not have a texture > associated > with it, it should use the one from the parent geode. If I put the shader in > the geode, > all geometry is drawn correctly. But if I try to load a different texture in > the child > drawable, the geode’s texture is used instead. Please help me figure out what > I am > missing. I’m starting to go bleary eyed! > > Here is the code that sets up the texture and shader in the geode (and this > works, the > texture loaded here shows up): > > stateSet = new osg::StateSet > texSampler = new osg::Uniform(“texture”, 0); > stateSet->addUniform(texSampler); > stateSet->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); > >... > stateSet->setAttribute(program); > stateSet->setAttributesAndModes(program.get(), osg::StateAttribute::ON); > this->setStateSet(stateSet); > > I then attempt to load a different texture in the drawable that is attached > to the above > geode. Here is the code I am attempting to use: > > stateSet = new osg::StateSet; > stateSet->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON | > osg::StateAttribute::PROTECTED); > > this->setStateSet(stateSet);
From the code and your description I would expect this to work as well. Did you try to duplicate the Uniform in the Drawable StateSet? Maybe this makes a difference? Cheers, /ulrich _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

