private SetPixelFormat ( IntPtr dc, int format, PixelFormatDescriptor &pfd ) : bool | ||
dc | IntPtr | |
format | int | |
pfd | PixelFormatDescriptor | |
return | bool |
// Note: there is no relevant ARB function. internal static void SetGraphicsModePFD(GraphicsMode mode, WinWindowInfo window) { Debug.Write("Setting pixel format... "); if (!mode.Index.HasValue) { throw new GraphicsModeException("Invalid or unsupported GraphicsMode."); } if (window == null) { throw new ArgumentNullException("window", "Must point to a valid window."); } 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())); } }
// 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); }
private void SetGraphicsModePFD(GraphicsMode mode, WinWindowInfo window) { if (!mode.Index.HasValue) { throw new GraphicsModeException("Invalid or unsupported GraphicsMode."); } if (window == null) { throw new ArgumentNullException("window", "Must point to a valid window."); } PixelFormatDescriptor formatDescriptor = new PixelFormatDescriptor(); Functions.DescribePixelFormat(window.DeviceContext, (int)mode.Index.Value, (int)API.PixelFormatDescriptorSize, ref formatDescriptor); if (!Functions.SetPixelFormat(window.DeviceContext, (int)mode.Index.Value, ref formatDescriptor)) { throw new GraphicsContextException(string.Format("Requested GraphicsMode not available. SetPixelFormat error: {0}", (object)Marshal.GetLastWin32Error())); } }