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

 

Attachment: Hint.cpp
Description: Hint.cpp

Attachment: Light.cpp
Description: Light.cpp

Attachment: ClipPlane
Description: ClipPlane

Attachment: Hint
Description: Hint

Attachment: Light
Description: Light

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to