From Alexander Irion, "When a osg::Geometry node is loaded from a ".osgb" file, there is no element buffer object created for the primitives element indices, although _useVertexBufferObjects is enabled. This bug decreases the rendering performance."

This commit is contained in:
Robert Osfield 2010-11-01 17:05:53 +00:00
parent 7b0a500ffc
commit cc93824605
2 changed files with 16 additions and 1 deletions

View File

@ -227,7 +227,8 @@ class OSG_EXPORT Geometry : public Drawable
typedef std::vector< ref_ptr<PrimitiveSet> > PrimitiveSetList; typedef std::vector< ref_ptr<PrimitiveSet> > PrimitiveSetList;
void setPrimitiveSetList(const PrimitiveSetList& primitives) { _primitives = primitives; dirtyDisplayList(); dirtyBound(); } void setPrimitiveSetList(const PrimitiveSetList& primitives);
PrimitiveSetList& getPrimitiveSetList() { return _primitives; } PrimitiveSetList& getPrimitiveSetList() { return _primitives; }
const PrimitiveSetList& getPrimitiveSetList() const { return _primitives; } const PrimitiveSetList& getPrimitiveSetList() const { return _primitives; }

View File

@ -509,6 +509,20 @@ bool Geometry::insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset)
return false; 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) bool Geometry::removePrimitiveSet(unsigned int i, unsigned int numElementsToRemove)
{ {
if (numElementsToRemove==0) return false; if (numElementsToRemove==0) return false;