protected virtual void DestroyFrameBuffer() { AssertValid(); AssertContext(); EAGLContext oldContext = EAGLContext.CurrentContext; if (!GraphicsContext.IsCurrent) { MakeCurrent(); } gl.DeleteFramebuffers(1, ref framebuffer); gl.DeleteRenderbuffers(1, ref renderbuffer); framebuffer = renderbuffer = 0; if (oldContext != EAGLContext) { EAGLContext.SetCurrentContext(oldContext); } else { EAGLContext.SetCurrentContext(null); } GraphicsContext.Dispose(); GraphicsContext = null; gl = null; }