From c0ffa5b07e5a9a4a860bb2927fe0aacadbc444f3 Mon Sep 17 00:00:00 2001 From: vrld Date: Mon, 5 Mar 2012 20:46:46 +0100 Subject: [PATCH] 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). --- src/modules/graphics/opengl/VertexBuffer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/VertexBuffer.cpp b/src/modules/graphics/opengl/VertexBuffer.cpp index 1c48ccbb2..07959545b 100644 --- a/src/modules/graphics/opengl/VertexBuffer.cpp +++ b/src/modules/graphics/opengl/VertexBuffer.cpp @@ -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)