/////////////////////////////////////////////////////////////////////////////////////////////////////////// //TODO: review here, this is our custom OpenGLContext //eg, used with glfw GraphicsContext(OpenTK.Platform.External.ExternalGraphicsContext externalGraphicsContext) { implementation = externalGraphicsContext; lock (SyncRoot) { IsExternal = true; //if (handle == ContextHandle.Zero) //{ // implementation = new OpenTK.Platform.Dummy.DummyGLContext(handle); //} //else if (available_contexts.ContainsKey(handle)) //{ // throw new GraphicsContextException("Context already exists."); //} //else //{ // switch ((flags & GraphicsContextFlags.Embedded) == GraphicsContextFlags.Embedded) // { // case false: implementation = Factory.Default.CreateGLContext(handle, window, shareContext, direct_rendering, major, minor, flags); break; // case true: implementation = Factory.Embedded.CreateGLContext(handle, window, shareContext, direct_rendering, major, minor, flags); break; // } //} available_contexts.Add((implementation as IGraphicsContextInternal).Context, new WeakReference(this)); (this as IGraphicsContextInternal).LoadAll(); GetCurrentContextDelegate temp = externalGraphicsContext.CreateCurrentContextDel(); if (temp != null) { GetCurrentContext = temp; } } }