Thanks, Robert -- I'm just updating to current svn now to take a look at the
change. It sounds like a good candidate for a 2.6.2 release.
   -Paul


> 
> Hi Paul and Brede,
> 
> I'm posting this email so you guys know that I just applied a 
> fix to a premature optimization that had been done in the 
> OpenFlight plugin.
> Paul you might want to apply this to the OpenSceneGraph-2.6 branch.
> The SVN revision is  9041.
> 
>   http://www.openscenegraph.org/projects/osg/changeset/9041
> 
> The change is to simply remove the "simple share stateset 
> optimization by adding an #if 0, #endif block to 
> GeometryRecords.cpp as below:
> 
> #if 0
> // note from Robert Osfield, this "optimization" breaks 
> multi-textured datasets that mix single texture // and 
> mulit-texture geometries as the Multitexture parsing can come 
> after the below code, and accidentally // polute the non 
> multi-texture geometries StateSet.
> 
>         // A simple share stateset optimization.
>         static osg::ref_ptr<osg::StateSet> lastStateset;
>         if (lastStateset.valid() && 
> (stateset->compare(*lastStateset,false)==0))
>             stateset = lastStateset;
>         else
>             lastStateset = stateset;
> #endif
> 
> 
> The problem itself appeared when a OpenFlight model had 
> geometries that had both single and multi-texturing 
> geometries in them, where the first texture unit's texture 
> was the same between the single texture coord geometry and 
> the multi-texture geometry, this resulted in the the above 
> optimizing concluding that the StateSet's could be shared, 
> but this optimization was being done prior the 
> MultiTextureRecord was being parsed, and when it was parsed 
> it applied its second texture to shared instance - hence 
> poluting the single texture coord geometry with a second 
> texture.  The visible results of this was random flickering 
> on of colours.
> 
> I haven't removed the above code, but it probably should be 
> removed completely as I can't see a way for the optimization 
> to be able to be done in GeometryRecords.cpp as the not 
> enough info is known at this point.  I've left the code in 
> right now to make clear what's been changed and why.
> 
> Robert.
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-o
penscenegraph.org
> 

_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to