Improved the management of the unbinding of VBO's and EBO's

This commit is contained in:
Robert Osfield
2017-03-09 18:17:53 +00:00
parent 445f2bfe21
commit 5b78e334a9

View File

@@ -858,12 +858,15 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
drawPrimitivesImplementation(renderInfo);
if (renderInfo.getState()->useVertexBufferObject(_supportsVertexBufferObjects && _useVertexBufferObjects) &&
(!state.useVertexArrayObject(_useVertexArrayObject) || state.getCurrentVertexArrayState()->getRequiresSetArrays()))
bool usingVertexBufferObjects = state.useVertexBufferObject(_supportsVertexBufferObjects && _useVertexBufferObjects);
bool usingVertexArrayObjects = usingVertexBufferObjects && state.useVertexArrayObject(_useVertexArrayObject);
if (usingVertexBufferObjects && !usingVertexArrayObjects)
{
// unbind the VBO's if any are used.
state.unbindVertexBufferObject();
state.unbindElementBufferObject();
osg::VertexArrayState* vas = state.getCurrentVertexArrayState();
vas->unbindVertexBufferObject();
vas->unbindElementBufferObject();
}
if (checkForGLErrors) state.checkGLErrors("end of Geometry::drawImplementation().");