public SelectGraphicsMode ( |
||
color | ||
depth | int | |
stencil | int | |
samples | int | |
accum | ||
buffers | int | |
stereo | bool | |
Результат | OpenTK.Graphics.GraphicsMode |
// Note: there is no relevant ARB function. internal static GraphicsMode SetGraphicsModePFD(WinGraphicsMode mode_selector, GraphicsMode mode, WinWindowInfo window) { Debug.Write("Setting pixel format... "); if (window == null) { throw new ArgumentNullException("window", "Must point to a valid window."); } if (!mode.Index.HasValue) { mode = mode_selector.SelectGraphicsMode( mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo); } PixelFormatDescriptor pfd = new PixelFormatDescriptor(); Functions.DescribePixelFormat( window.DeviceContext, (int)mode.Index.Value, API.PixelFormatDescriptorSize, ref pfd); Debug.WriteLine(mode.Index.ToString()); if (!Functions.SetPixelFormat(window.DeviceContext, (int)mode.Index.Value, ref pfd)) { throw new GraphicsContextException(String.Format( "Requested GraphicsMode not available. SetPixelFormat error: {0}", Marshal.GetLastWin32Error())); } return(mode); }
// Note: there is no relevant ARB function. internal static GraphicsMode SetGraphicsModePFD(WinGraphicsMode mode_selector, GraphicsMode mode, WinWindowInfo window) { Debug.Write("Setting pixel format... "); if (window == null) throw new ArgumentNullException("window", "Must point to a valid window."); if (!mode.Index.HasValue) { mode = mode_selector.SelectGraphicsMode( mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo); } PixelFormatDescriptor pfd = new PixelFormatDescriptor(); Functions.DescribePixelFormat( window.DeviceContext, (int)mode.Index.Value, API.PixelFormatDescriptorSize, ref pfd); Debug.WriteLine(mode.Index.ToString()); if (!Functions.SetPixelFormat(window.DeviceContext, (int)mode.Index.Value, ref pfd)) { throw new GraphicsContextException(String.Format( "Requested GraphicsMode not available. SetPixelFormat error: {0}", Marshal.GetLastWin32Error())); } return mode; }