Powerino73's picture

Memory error with Gl.glDeleteBuffersARB in finilize class

I have a vertexbuffer class and when the GC call the finalize i call the Gl.glDeleteBuffersARB to delete buffer.
But this instruction give me an exception of read write memory error.
Anyone knows why?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
zahirtezcan's picture

For any GL.... call you need an active OpenGL context, such that you need to call MakeCurrent for that thread.

Finalizers are called on a special thread called finalizer thread, which has no active OpenGL context. So, you need to call for DeleteBuffers method on the thread on which the context(you created your buffers on) is active.