[osg-users] Fixes for errors in osg::Light, osg::Hint and osg::ClipPlane

Schmidt, Richard, SDGE1 Richard.Schmidt at eads.com
Mon Oct 15 06:48:49 PDT 2007


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 fort he 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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071015/55e317d1/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixes.zip
Type: application/x-zip-compressed
Size: 6838 bytes
Desc: fixes.zip
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071015/55e317d1/attachment-0002.bin>


More information about the osg-users mailing list