Restructured the clean up of arrays/primitives and GL objects
This commit is contained in:
@@ -256,8 +256,28 @@ Drawable::Drawable(const Drawable& drawable,const CopyOp& copyop):
|
||||
|
||||
Drawable::~Drawable()
|
||||
{
|
||||
_stateset = 0;
|
||||
Drawable::releaseGLObjects();
|
||||
// clean up display lists if assigned, for the display lists size we can't use glGLObjectSizeHint() as it's a virtual function, so have to default to a 0 size hint.
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
for(unsigned int i=0;i<_globjList.size();++i)
|
||||
{
|
||||
if (_globjList[i] != 0)
|
||||
{
|
||||
Drawable::deleteDisplayList(i,_globjList[i], 0); // we don't know getGLObjectSizeHint()
|
||||
_globjList[i] = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// clean up VertexArrayState
|
||||
for(unsigned int i=0; i<_vertexArrayStateList.size(); ++i)
|
||||
{
|
||||
VertexArrayState* vas = _vertexArrayStateList[i].get();
|
||||
if (vas)
|
||||
{
|
||||
vas->release();
|
||||
_vertexArrayStateList[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
osg::MatrixList Drawable::getWorldMatrices(const osg::Node* haltTraversalAtNode) const
|
||||
@@ -319,6 +339,7 @@ void Drawable::releaseGLObjects(State* state) const
|
||||
// current OpenGL context.
|
||||
unsigned int contextID = state->getContextID();
|
||||
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
if (_useDisplayList)
|
||||
{
|
||||
// get the globj for the current contextID.
|
||||
@@ -331,6 +352,7 @@ void Drawable::releaseGLObjects(State* state) const
|
||||
globj = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
VertexArrayState* vas = contextID <_vertexArrayStateList.size() ? _vertexArrayStateList[contextID].get() : 0;
|
||||
if (vas)
|
||||
|
||||
Reference in New Issue
Block a user