Changed the clean up of the GL objects on destruction so that the destructors of the arrays/primitives themselves do the release rather than have it done explictly in the destructor. This allows arrays/primitives to be shared.

This commit is contained in:
Robert Osfield
2018-12-31 11:06:45 +00:00
parent 7a601753e0
commit b7947b13f3

View File

@@ -83,7 +83,21 @@ Geometry::Geometry(const Geometry& geometry,const CopyOp& copyop):
Geometry::~Geometry()
{
_stateset = 0;
#if 1
// use the destructors to automatically handle GL object clean up when the array/primtives ref count goes to 0
_primitives.clear();
_vertexArray = 0;
_normalArray = 0;
_colorArray = 0;
_secondaryColorArray = 0;
_fogCoordArray = 0;
_texCoordList.clear();
_vertexAttribList.clear();
#else
// original clean up that cleans up GL objects regardless of any sharing of arrays/primitives
Geometry::releaseGLObjects();
#endif
}
#define ARRAY_NOT_EMPTY(array) (array!=0 && array->getNumElements()!=0)