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?
Posted Tuesday, 6 July, 2010 - 17:51 by zahirtezcan
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.
Comments
Re: Memory error with Gl.glDeleteBuffersARB in finilize ...
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.