OpenTK.Platform.MacOS.MacOSGraphicsMode.SelectGraphicsMode C# (CSharp) Method

SelectGraphicsMode() public method

public SelectGraphicsMode ( ColorFormat color, int depth, int stencil, int samples, ColorFormat accum, int buffers, bool stereo ) : OpenTK.Graphics.GraphicsMode
color OpenTK.Graphics.ColorFormat
depth int
stencil int
samples int
accum OpenTK.Graphics.ColorFormat
buffers int
stereo bool
return OpenTK.Graphics.GraphicsMode
        public GraphicsMode SelectGraphicsMode(ColorFormat color, int depth, int stencil, int samples, ColorFormat accum, int buffers, bool stereo)
        {
            GraphicsMode gfx = new GraphicsMode((IntPtr)1, color, depth, stencil, samples,
                                                 accum, buffers, stereo);
            System.Diagnostics.Debug.Print("Created dummy graphics mode.");
            return gfx;
        }

Usage Example

Example #1
0
        void CreateContext(GraphicsMode mode, CarbonWindowInfo carbonWindow, IntPtr shareContextRef, bool fullscreen)
        {
            Debug.Print("AGL pixel format attributes:");

            AGLPixelFormat myAGLPixelFormat;

            // Choose a pixel format with the attributes we specified.
            IntPtr gdevice;
            IntPtr cgdevice = GetQuartzDevice(carbonWindow);

            if (cgdevice == IntPtr.Zero)
            {
                cgdevice = (IntPtr)DisplayDevice.Default.Id;
            }

            OSStatus status = Carbon.API.DMGetGDeviceByDisplayID(cgdevice, out gdevice, false);

            if (status != OSStatus.NoError)
            {
                throw new MacOSException(status, "DMGetGDeviceByDisplayID failed.");
            }

            IGraphicsMode selector = new MacOSGraphicsMode(gdevice);

            Mode = selector.SelectGraphicsMode(
                mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples,
                mode.AccumulatorFormat, mode.Buffers, mode.Stereo);
            MyAGLReportError("aglChoosePixelFormat");

            Debug.Print("Creating AGL context.  Sharing with {0}", shareContextRef);
            myAGLPixelFormat = Mode.Index.Value;

            // create the context and share it with the share reference.
            Handle = new ContextHandle(Agl.aglCreateContext(myAGLPixelFormat, shareContextRef));
            MyAGLReportError("aglCreateContext");

            // Free the pixel format from memory.
            Agl.aglDestroyPixelFormat(myAGLPixelFormat);
            MyAGLReportError("aglDestroyPixelFormat");

            Debug.Print("IsControl: {0}", carbonWindow.IsControl);

            SetDrawable(carbonWindow);
            SetBufferRect(carbonWindow);
            Update(carbonWindow);

            MakeCurrent(carbonWindow);
            Debug.Print("context: {0}", Handle.Handle);
        }
All Usage Examples Of OpenTK.Platform.MacOS.MacOSGraphicsMode::SelectGraphicsMode
MacOSGraphicsMode