Hi Robert, a proper solution could be by setting member variables(lightnum, clipplane, etc.) only through the constructor.
Richard Hi Richard, Could you send future submissions to osg-submissions as ones to osg-users can easily be lost. As for caching in StateSet this does make the assumption that the light number/clip plane number is invariant once assigned. This is done for efficiency purposes and is a trade off in the design. Robert. On 10/23/07, Schmidt, Richard, SDGE1 <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > if you have problems with multiple lightsources in your scenegraph not > glEnableling/glDisableing correctly this may be a solution for you. > > > > First lets recap the error: > > > > osg::Light* l1 = new osg::Light(); > > osg::Light* l2 = new osg::Light(); > > > > osg::StateSet* stateSet = new osg::StateSet(); > > stateSet->setAttributeAndModes( l1 ); > > stateSet->setAttributeAndModes( l2 ); > > > > l1->setLightNum( 0 ); l2->setLightNum( 1 ); > > > > 1. This won't work, because the stateset caches the type/member of the > attribute. If you change the member afterwards things will blow up... > > 2. Next bug is here that osg caches stateattributes internally, using the > method cloneType. cloneType however needs to clone the member as well, so > the glDisable will be called for the correct light. > > > > Attached you will find a version which fixed (2.) . For 1. the interface osg > provides should be changed (currently catched using assertions). > > > > Richard > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g > > > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org