mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
fix gl crash
This commit is contained in:
parent
9e75c3dfd9
commit
0bfd8ed6f9
@ -1866,6 +1866,16 @@ release_vertex_buffer(VertexBufferContext *vbc) {
|
|||||||
GLCAT.debug()
|
GLCAT.debug()
|
||||||
<< "deleting vertex buffer " << gvbc->_index << "\n";
|
<< "deleting vertex buffer " << gvbc->_index << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the buffer is unbound before we delete it. Not
|
||||||
|
// strictly necessary according to the OpenGL spec, but it might
|
||||||
|
// help out a flaky driver, and we need to keep our internal state
|
||||||
|
// consistent anyway.
|
||||||
|
if (_current_vbuffer_index == gvbc->_index) {
|
||||||
|
_glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
_current_vbuffer_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
_glDeleteBuffers(1, &gvbc->_index);
|
_glDeleteBuffers(1, &gvbc->_index);
|
||||||
report_my_gl_errors();
|
report_my_gl_errors();
|
||||||
|
|
||||||
@ -2011,6 +2021,16 @@ release_index_buffer(IndexBufferContext *ibc) {
|
|||||||
GLCAT.debug()
|
GLCAT.debug()
|
||||||
<< "deleting index buffer " << gibc->_index << "\n";
|
<< "deleting index buffer " << gibc->_index << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the buffer is unbound before we delete it. Not
|
||||||
|
// strictly necessary according to the OpenGL spec, but it might
|
||||||
|
// help out a flaky driver, and we need to keep our internal state
|
||||||
|
// consistent anyway.
|
||||||
|
if (_current_ibuffer_index == gibc->_index) {
|
||||||
|
_glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
_current_ibuffer_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
_glDeleteBuffers(1, &gibc->_index);
|
_glDeleteBuffers(1, &gibc->_index);
|
||||||
report_my_gl_errors();
|
report_my_gl_errors();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user