diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-04-02 02:40:05 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-04-02 02:41:14 +0400 |
commit | e60b18d51d58e327031961970405453becca1653 (patch) | |
tree | 2da2ba7009e8b04ddc9a33f775748ebba760fdd2 /source/blender | |
parent | 0a112efcf7269f8d50587ab1056d871ef2c0f747 (diff) |
Dyntopo: Delete OpenGL buffers of nodes that do not have any more
triangles.
It is possible to end up with such nodes using brushes in aggressive
collapse mode. Those nodes should normally be cleaned up, since they can
never be actually reused (adding more geometry to a node requires the
node having some geometry to begin with) but until we support dynamic
nodes, better delete those to avoid binding graphics driver resources.
If such zero elements buffers were used, GL error out of memory would be
reported.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 3882b7c8ebe..3d5879b22d3 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -2046,6 +2046,19 @@ void GPU_update_bmesh_pbvh_buffers(GPU_PBVH_Buffers *buffers, else totvert = tottri * 3; + /* some nodes may lose all their vertices/faces. Normally we should delete those but since we don't + * support dynamic nodes yet, just return immediately to avoid opengl errors */ + if (!tottri) { + if (buffers->index_buf) + glDeleteBuffersARB(1, &buffers->index_buf); + if (buffers->vert_buf) + glDeleteBuffersARB(1, &buffers->vert_buf); + buffers->vert_buf = 0; + buffers->index_buf = 0; + buffers->tot_tri = 0; + return; + } + /* Initialize vertex buffer */ glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf); glBufferDataARB(GL_ARRAY_BUFFER_ARB, |