diff --git a/include/osg/State b/include/osg/State index 864078c2e..afff8341f 100644 --- a/include/osg/State +++ b/include/osg/State @@ -549,8 +549,12 @@ class OSG_EXPORT State : public Referenced /** Set the getCurrentVertexArrayState to the GlobalVertexArrayState.*/ void setCurrentToGlobalVertexArrayState() { _vas = _globalVertexArrayState.get(); } - /** Reset the CurrentVertexArrayObject if it's value equals the specificied vas - use when deleting a vas.*/ - void resetCurrentVertexArrayStateOnMatch(VertexArrayState* vas) { if (_vas==vas) { _vas = _globalVertexArrayState.get(); _currentVAO = 0; } } + /** Reset the CurrentVertexArrayState/VertexArrayObject if it's value matches the specificied vas - use when deleting a vas.*/ + void resetCurrentVertexArrayStateOnMatch(VertexArrayState* vas) + { + if (vas->getVertexArrayObject()== _currentVAO) _currentVAO = 0; + if (_vas==vas) _vas = _globalVertexArrayState.get(); + } /** disable the vertex, normal, color, tex coords, secondary color, fog coord and index arrays.*/