mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
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:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user