aglGetCurrentContext() private method

private aglGetCurrentContext ( ) : AGLContext
return AGLContext
Ejemplo n.º 1
0
 public virtual GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()
 {
     return((GraphicsContext.GetCurrentContextDelegate) delegate
     {
         return new ContextHandle(Agl.aglGetCurrentContext());
     });
 }
Ejemplo n.º 2
0
        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()));
            });
        }