Browse Source

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).
vrld 13 years ago
parent
commit
c0ffa5b07e
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/modules/graphics/opengl/VertexBuffer.cpp

+ 3 - 1
src/modules/graphics/opengl/VertexBuffer.cpp

@@ -195,13 +195,15 @@ namespace opengl
 		const GLvoid *src = restore ? buffer_copy : 0;
 		const GLvoid *src = restore ? buffer_copy : 0;
 
 
 		// Note that if 'src' is '0', no data will be copied.
 		// Note that if 'src' is '0', no data will be copied.
+		glGetError();
 		glBufferDataARB(getTarget(), getSize(), src, getUsage());
 		glBufferDataARB(getTarget(), getSize(), src, getUsage());
+		GLenum err = glGetError();
 
 
 		// Clean up buffer_copy, if it exists.
 		// Clean up buffer_copy, if it exists.
 		delete[] buffer_copy;
 		delete[] buffer_copy;
 		buffer_copy = 0;
 		buffer_copy = 0;
 
 
-		return true;
+		return (GL_NO_ERROR != err);
 	}
 	}
 
 
 	void VBO::unload(bool save)
 	void VBO::unload(bool save)