> void Text::computePositions() > { > unsigned int size = > osg::maximum(osg::DisplaySettings::instance()->getMaxNumberOfGraphicsCon > texts(),_autoTransformCache.size()); > > // FIXME: OPTIMIZE: This would be one of the ideal locations to > // call computeAverageGlypthWidthAndHeight(). It is out of the > contextID loop > // so the value would be computed fewer times. But the code will > need changes > // to get the value down to the locations it is needed. (Either pass > through parameters > // or member variables, but we would need a system to know if the > values are stale.) > > for(unsigned int i=0;i<size;++i) > { > computePositions(i); > } > }
So I am not an expert on the osgText implementation, but I think I am the one that wrote that comment. I wrote that when I added the backdrop text and gradient feature to osgText. My strategy was to make the least amount of structural changes as possible because the implementation was sufficiently complicated enough, so optimization wasn't my goal. I think that above block already existed in some form before my changes, but as I was refactoring trying to fit in the new features, I think I took note of that block of code and added that comment realizing it could be faster. I suggest if you are looking for a way to speed things up, you could try to do exactly what that comment says. I honestly don't remember the code at this point, and I never really profiled how much time was spent in that loop. But I think it is one of the more staightforward and obvious places that can be optimized (but probably tedious). Another thing to note is with the backdrop feature on, it isn't terribly efficient if I recall, because it needs to repeat for every direction of the shadow. So if you do outline text, you multiply by 8 or 9 passes. So don't turn on backdrop text if there are performance problems. -Eric _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org