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

Schmidt, Richard, SDGE1 Richard.Schmidt at eads.com
Tue Oct 23 00:41:12 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 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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071023/f366bcb1/attachment-0003.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Hint.cpp
Type: application/octet-stream
Size: 924 bytes
Desc: Hint.cpp
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071023/f366bcb1/attachment-0015.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Light.cpp
Type: application/octet-stream
Size: 4165 bytes
Desc: Light.cpp
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071023/f366bcb1/attachment-0016.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ClipPlane
Type: application/octet-stream
Size: 4362 bytes
Desc: ClipPlane
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071023/f366bcb1/attachment-0017.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Hint
Type: application/octet-stream
Size: 2756 bytes
Desc: Hint
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071023/f366bcb1/attachment-0018.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Light
Type: application/octet-stream
Size: 7745 bytes
Desc: Light
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071023/f366bcb1/attachment-0019.obj>


More information about the osg-users mailing list