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

Schmidt, Richard, SDGE1 Richard.Schmidt at eads.com
Tue Oct 23 02:45:56 PDT 2007


Dooh,
I submitted an outdated version.

The clipplane ::cloneType must clone the MemberType only and not the
clipplane as well.

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 <Richard.Schmidt at eads.com> 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 at lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
>
>
>
_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ClipPlane
Type: application/octet-stream
Size: 4417 bytes
Desc: ClipPlane
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071023/6f0783a7/attachment-0003.obj>


More information about the osg-users mailing list