diff options
author | Brian Paul <[email protected]> | 2003-09-17 18:58:09 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-09-17 18:58:09 +0000 |
commit | 6296276ebe2b30080af0eb8503b15f5b379c9b87 (patch) | |
tree | 8a23623187a96dcd164f28635c947d2b82df17e0 /src/mesa/main/bufferobj.c | |
parent | 1ceeac29ec67816fe62c15c8e9386a24911628a2 (diff) |
unbind vertex arrays from buffer in DeleteBuffersARB()
Diffstat (limited to 'src/mesa/main/bufferobj.c')
-rw-r--r-- | src/mesa/main/bufferobj.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 45631c924b4..9289b77d607 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -453,8 +453,33 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) struct gl_buffer_object *bufObj = (struct gl_buffer_object *) _mesa_HashLookup(ctx->Shared->BufferObjects, ids[i]); if (bufObj) { + /* unbind any vertex pointers bound to this buffer */ + GLuint j; + if (ctx->Array.Vertex.BufferObj == bufObj) + ctx->Array.Vertex.BufferObj = ctx->Array.NullBufferObj; + if (ctx->Array.Normal.BufferObj == bufObj) + ctx->Array.Normal.BufferObj = ctx->Array.NullBufferObj; + if (ctx->Array.Color.BufferObj == bufObj) + ctx->Array.Color.BufferObj = ctx->Array.NullBufferObj; + if (ctx->Array.SecondaryColor.BufferObj == bufObj) + ctx->Array.SecondaryColor.BufferObj = ctx->Array.NullBufferObj; + if (ctx->Array.FogCoord.BufferObj == bufObj) + ctx->Array.FogCoord.BufferObj = ctx->Array.NullBufferObj; + if (ctx->Array.Index.BufferObj == bufObj) + ctx->Array.Index.BufferObj = ctx->Array.NullBufferObj; + if (ctx->Array.EdgeFlag.BufferObj == bufObj) + ctx->Array.EdgeFlag.BufferObj = ctx->Array.NullBufferObj; + for (j = 0; j < MAX_TEXTURE_UNITS; j++) { + if (ctx->Array.TexCoord[j].BufferObj == bufObj) + ctx->Array.TexCoord[j].BufferObj = ctx->Array.NullBufferObj; + } + for (j = 0; j < VERT_ATTRIB_MAX; j++) { + if (ctx->Array.VertexAttrib[j].BufferObj == bufObj) + ctx->Array.VertexAttrib[j].BufferObj = ctx->Array.NullBufferObj; + } + if ( (bufObj->Target == GL_ARRAY_BUFFER_ARB) - || (bufObj->Target == GL_ELEMENT_ARRAY_BUFFER_ARB) ) { + || (bufObj->Target == GL_ELEMENT_ARRAY_BUFFER_ARB) ) { _mesa_BindBufferARB( bufObj->Target, 0 ); } else if (bufObj->Target == 0) { |