public virtual GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext() { return((GraphicsContext.GetCurrentContextDelegate) delegate { return new ContextHandle(Agl.aglGetCurrentContext()); }); }
private void CreateContext(GraphicsMode mode, IWindowInfo carbonWindow, IntPtr shareContextRef, bool fullscreen) { Debug.Print("AGL pixel format attributes:"); // Choose a pixel format with the attributes we specified. AGLPixelFormat pixelformat; AglGraphicsMode selector = new AglGraphicsMode(); Mode = selector.SelectGraphicsMode( mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo, out pixelformat); MyAGLReportError("aglChoosePixelFormat"); Debug.Print("Creating AGL context. Sharing with {0}", shareContextRef); // create the context and share it with the share reference. Context = new ContextHandle(Agl.aglCreateContext(pixelformat, shareContextRef)); MyAGLReportError("aglCreateContext"); // Free the pixel format from memory. Agl.aglDestroyPixelFormat(pixelformat); MyAGLReportError("aglDestroyPixelFormat"); SetDrawable(carbonWindow); SetBufferRect(carbonWindow); Update(carbonWindow); MakeCurrent(carbonWindow); Debug.Print("context: {0}", Context.Handle); dummyContext = new GraphicsContext(Context, GetAddress, delegate { return(new ContextHandle(Agl.aglGetCurrentContext())); }); }