Added handling of failure to create ElementBufferObject.

This commit is contained in:
Robert Osfield 2016-06-02 15:35:47 +01:00
parent 9eb9186200
commit 700e38ba9d

View File

@ -958,14 +958,21 @@ void SharedGeometry::drawImplementation(osg::RenderInfo& renderInfo) const
osg::GLBufferObject* ebo = _drawElements->getOrCreateGLBufferObject(state.getContextID());
if (ebo)
{
state.bindElementBufferObject(ebo);
glDrawElements(primitiveType, _drawElements->getNumIndices(), _drawElements->getDataType(), (const GLvoid *)(ebo->getOffset(_drawElements->getBufferIndex())));
state.unbindElementBufferObject();
}
else
{
glDrawElements(primitiveType, _drawElements->getNumIndices(), _drawElements->getDataType(), _drawElements->getDataPointer());
}
// unbind the VBO's if any are used.
state.unbindVertexBufferObject();
state.unbindElementBufferObject();
if (checkForGLErrors) state.checkGLErrors("end of SharedGeometry::drawImplementation().");
}