Hi J-S, Can you try to use a ref pointer instead of the regular pointer for "osg::Shader* shader". I believe I encountered exactly this issue when working on the PSSM, please see a patch that I sent +/- a week ago.
The shader was not cleaned up in the case of PSSM, and hence the new one was not created. bye bye Raymond > Hello, > > I am using osgShadow::ShadowMap. Shadows show up fine, but I am trying > to change shaders on it, and it doesn't react to my changes. > > I've even added this code to try some things out, in my frame loop: > > static int f = 0; > if (f == 200) // After 200 frames > { > // sm is the osg::ref_ptr<osgShadow::ShadowMap> that is used. > float size = 4096; > sm->setTextureSize(osg::Vec2s(size, size)); > > sm->setAmbientBias(osg::Vec2(0.0, 0.0)); > > sm->clearShaderList(); > osg::Shader* shader = new osg::Shader(osg::Shader::FRAGMENT); > shader->loadShaderSourceFromFile("shader.frag"); // > outputs red > sm->addShader(shader); > > sm->dirty(); > } > f++; > > Note that I am calling sm->dirty()... Out of those lines, only the > change in texture size takes effect. The other two (change ambient > bias to a value that should be very visible, and change shaders to one > that outputs all red pixels) do not appear to take effect. > > If it makes a difference, we are using osgViewer::CompositeViewer. The > scene graph is > > Group > Some osgText::Text objects > ShadowedScene > Group > The rest of the scene > > I have done the same thing in the osgShadow example, and the changes > take effect! So I am wondering what would cause something like that. > > Any ideas? > > Thanks in advance, > > J-S > -- > ______________________________________________________ > Jean-Sebastien Guay [EMAIL PROTECTED] > http://whitestar02.webhop.org/ > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org