From 7ba85b16db07f8f166f4f980cc3391f6058b2099 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 16 Jul 2009 11:09:16 +0000 Subject: [PATCH] From Colin MacDonald, "The Optimizer Merge Geometry visitor is always merging geometries, even if they have had DataVariance DYNAMIC explicitly specified. Then when an application attempts to dynamically update the geometry in the frame loop the primitive sets and data arrays are no longer as expected, leading to display and/or memory corruption. Attached is a simple fix." Note from Robert Osfield, tweaked Colin's changes so that it uses != DYNAMIC rather == STATIC in the additional test. Merged from svn/trunk using: svn merge -r 10479:10480 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgUtil/Optimizer.cpp --- src/osgUtil/Optimizer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 620185d24..f73cadcad 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -1811,7 +1811,9 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) { //geom->computeCorrectBindingsAndArraySizes(); - if (!geometryContainsSharedArrays(*geom) && isOperationPermissibleForObject(geom)) + if (!geometryContainsSharedArrays(*geom) && + geom->getDataVariance()!=osg::Object::DYNAMIC && + isOperationPermissibleForObject(geom)) { geometryDuplicateMap[geom].push_back(geom); }