diff --git a/include/osg/Geometry b/include/osg/Geometry index 63d882935..acf73e5a4 100644 --- a/include/osg/Geometry +++ b/include/osg/Geometry @@ -227,7 +227,8 @@ class OSG_EXPORT Geometry : public Drawable typedef std::vector< ref_ptr > PrimitiveSetList; - void setPrimitiveSetList(const PrimitiveSetList& primitives) { _primitives = primitives; dirtyDisplayList(); dirtyBound(); } + void setPrimitiveSetList(const PrimitiveSetList& primitives); + PrimitiveSetList& getPrimitiveSetList() { return _primitives; } const PrimitiveSetList& getPrimitiveSetList() const { return _primitives; } diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index c199bf8ed..8d2b40448 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -509,6 +509,20 @@ bool Geometry::insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset) return false; } +void Geometry::setPrimitiveSetList(const PrimitiveSetList& primitives) +{ + _primitives = primitives; + if (_useVertexBufferObjects) + { + for (unsigned int primitiveSetIndex=0;primitiveSetIndex<_primitives.size();++primitiveSetIndex) + { + addElementBufferObjectIfRequired(_primitives[primitiveSetIndex]); + } + + } + dirtyDisplayList(); dirtyBound(); +} + bool Geometry::removePrimitiveSet(unsigned int i, unsigned int numElementsToRemove) { if (numElementsToRemove==0) return false;