Add error checking in VBO::load().

VertexBuffer should now be able to fall back to vertex arrays if
glBufferDataARB() fails (possible due to lack of memory).
This commit is contained in:
vrld
2012-03-05 20:46:46 +01:00
parent b956813e8e
commit c0ffa5b07e
+3 -1
View File
@@ -195,13 +195,15 @@ namespace opengl
const GLvoid *src = restore ? buffer_copy : 0;
// Note that if 'src' is '0', no data will be copied.
glGetError();
glBufferDataARB(getTarget(), getSize(), src, getUsage());
GLenum err = glGetError();
// Clean up buffer_copy, if it exists.
delete[] buffer_copy;
buffer_copy = 0;
return true;
return (GL_NO_ERROR != err);
}
void VBO::unload(bool save)