[osg-users] Problem with Optimizer - FLATTEN_STATIC_TRANSFORMS

Brian osgscene at gmail.com
Sun Sep 14 07:19:04 PDT 2008

I ran the problem through a debugger.  It looks like you are right that it
has to do with shared vertex arrays.  The problem occurs in the file
Optimizer.cpp.  In the function void
Optimizer::FlattenStaticTransformsVisitor::apply(osg::Geode& geode)

It looks like there is some code to deal with this problem.

      if ((b)&&(b2))
                        if(geometry->getVertexArray() &&
geometry->getVertexArray()->referenceCount() > 1) {

                        if(geometry->getNormalArray() &&
geometry->getNormalArray()->referenceCount() > 1) {


It makes a copy of the vertex array for shared vertex arrays but there is a
call to the funciton isOperationPermissibleForObject(&geode) that returns
false in my case because there is a stateset attached to the geode.  I don't
understand why should it block the copy/clone if a stateset is attached to
the geode.  Is the isOperationPermissibleForObject(&geode) really needed?
We are cloning the verexarray not the geode.


>From you accounts, my guess is that the .dae plugin is loading
> geometry with shared vertex arrays, then the
> FlattenStaticTransformVisitor is flattening the geometry but not
> properly recognizing that fact that shared vertices straddle two
> separately transformed subgraphs.
> I recall this problem arising before and think that a fix was
> submitted and checked in for it, but perhaps this wasn't resolved.
> Have a look through the svn log for Optimizer.cpp.
> Robert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080914/eaf7ad98/attachment-0003.htm>

More information about the osg-users mailing list