Exemple #1
0
        bool IsAccelerationSupported()
        {
            IntPtr pf    = IntPtr.Zero;
            int    count = 0;

            Cgl.ChoosePixelFormat(new int[] { (int)Cgl.PixelFormatBool.Accelerated, 0 },
                                  ref pf, ref count);

            if (pf != IntPtr.Zero)
            {
                Cgl.DestroyPixelFormat(pf);
            }

            return(pf != IntPtr.Zero);
        }
Exemple #2
0
        private GraphicsMode GetGraphicsMode(IntPtr context)
        {
            IntPtr cgl_context = Cocoa.SendIntPtr(context, Selector.Get("CGLContextObj"));
            IntPtr cgl_format  = Cgl.GetPixelFormat(cgl_context);

            int  id = 0; // CGL does not support the concept of a pixel format id
            int  color, depth, stencil, samples, accum;
            bool doublebuffer, stereo;

            Cgl.DescribePixelFormat(cgl_format, 0, Cgl.PixelFormatInt.ColorSize, out color);
            Cgl.DescribePixelFormat(cgl_format, 0, Cgl.PixelFormatInt.DepthSize, out depth);
            Cgl.DescribePixelFormat(cgl_format, 0, Cgl.PixelFormatInt.StencilSize, out stencil);
            Cgl.DescribePixelFormat(cgl_format, 0, Cgl.PixelFormatInt.Samples, out samples);
            Cgl.DescribePixelFormat(cgl_format, 0, Cgl.PixelFormatInt.AccumSize, out accum);
            Cgl.DescribePixelFormat(cgl_format, 0, Cgl.PixelFormatBool.Doublebuffer, out doublebuffer);
            Cgl.DescribePixelFormat(cgl_format, 0, Cgl.PixelFormatBool.Stereo, out stereo);

            return(new GraphicsMode((IntPtr)id, color, depth, stencil, samples, accum, doublebuffer ? 2 : 1, stereo));
        }