当前位置: 首页>>代码示例>>C#>>正文


C# Windows.PixelFormatDescriptor类代码示例

本文整理汇总了C#中OpenTK.Platform.Windows.PixelFormatDescriptor的典型用法代码示例。如果您正苦于以下问题:C# PixelFormatDescriptor类的具体用法?C# PixelFormatDescriptor怎么用?C# PixelFormatDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PixelFormatDescriptor类属于OpenTK.Platform.Windows命名空间,在下文中一共展示了PixelFormatDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DescribePixelFormat

 int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, PixelFormatDescriptor[] ppfd)
 {
     unsafe
     {
         fixed (PixelFormatDescriptor* ppfd_ptr = ppfd)
         {
             return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd_ptr);
         }
     }
 }
开发者ID:nebenjamin,项目名称:cpsc-431-project,代码行数:10,代码来源:Wgl.cs

示例2: ChoosePixelFormat

 int ChoosePixelFormat(IntPtr hDc, ref PixelFormatDescriptor pPfd)
 {
     unsafe
     {
         fixed (PixelFormatDescriptor* pPfd_ptr = &pPfd)
         {
             return Delegates.wglChoosePixelFormat((IntPtr)hDc, (PixelFormatDescriptor*)pPfd_ptr);
         }
     }
 }
开发者ID:nebenjamin,项目名称:cpsc-431-project,代码行数:10,代码来源:Wgl.cs

示例3: SetPixelFormat

 internal static extern bool SetPixelFormat(IntPtr dc, int format, ref PixelFormatDescriptor pfd);
开发者ID:jpbruyere,项目名称:opentk,代码行数:1,代码来源:API.cs

示例4: ChoosePixelFormat

 internal static extern int ChoosePixelFormat(IntPtr dc, ref PixelFormatDescriptor pfd);
开发者ID:jpbruyere,项目名称:opentk,代码行数:1,代码来源:API.cs

示例5: SetPixelFormat

 internal extern static Boolean SetPixelFormat(IntPtr hdc, int ipfd, ref PixelFormatDescriptor ppfd);
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:1,代码来源:Wgl.cs

示例6: ChoosePixelFormat

 internal extern static unsafe int ChoosePixelFormat(IntPtr hDc, ref PixelFormatDescriptor pPfd);
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:1,代码来源:Wgl.cs

示例7: DescribePixelFormat

 static int DescribePixelFormat(IntPtr hdc, int ipfd, int cjpfd, ref PixelFormatDescriptor pfd)
 {
     unsafe
     {
         fixed (PixelFormatDescriptor* ppfd = &pfd)
         {
             // Note: DescribePixelFormat found in gdi32 is extremely slow
             // on nvidia, for some reason.
             return Wgl.Imports.DescribePixelFormat(hdc, ipfd, (uint)cjpfd, ppfd);
         }
     }
 }
开发者ID:challal,项目名称:scallion,代码行数:12,代码来源:WinGraphicsMode.cs

示例8: DescribePixelFormatPFD

 static GraphicsMode DescribePixelFormatPFD(IntPtr device, ref PixelFormatDescriptor pfd,
     int pixelformat)
 {
     GraphicsMode created_mode = null;
     if (Functions.DescribePixelFormat(device, pixelformat, pfd.Size, ref pfd) > 0)
     {
         created_mode = new GraphicsMode(
             new IntPtr(pixelformat),
             new ColorFormat(pfd.RedBits, pfd.GreenBits, pfd.BlueBits, pfd.AlphaBits),
             pfd.DepthBits,
             pfd.StencilBits,
             0, // MSAA not supported when using PixelFormatDescriptor
             new ColorFormat(pfd.AccumRedBits, pfd.AccumGreenBits, pfd.AccumBlueBits, pfd.AccumAlphaBits),
             (pfd.Flags & PixelFormatDescriptorFlags.DOUBLEBUFFER) != 0 ? 2 : 1,
             (pfd.Flags & PixelFormatDescriptorFlags.STEREO) != 0);
     }
     return created_mode;
 }
开发者ID:jpbruyere,项目名称:opentk,代码行数:18,代码来源:WinGraphicsMode.cs

示例9: SetPixelFormat

 internal static bool SetPixelFormat(IntPtr hdc, int ipfd, PixelFormatDescriptor* ppfd);
开发者ID:Zeludon,项目名称:FEZ,代码行数:1,代码来源:Wgl.cs

示例10: DescribePixelFormat

 internal static int DescribePixelFormat(IntPtr hdc, int ipfd, uint cjpfd, PixelFormatDescriptor* ppfd);
开发者ID:Zeludon,项目名称:FEZ,代码行数:1,代码来源:Wgl.cs

示例11: ChoosePixelFormat

 internal static int ChoosePixelFormat(IntPtr hDc, PixelFormatDescriptor* pPfd);
开发者ID:Zeludon,项目名称:FEZ,代码行数:1,代码来源:Wgl.cs

示例12: DescribePixelFormat

 private static unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, int cjpfd, ref PixelFormatDescriptor pfd)
 {
     fixed (PixelFormatDescriptor* ppfd = &pfd)
     return Wgl.Imports.DescribePixelFormat(hdc, ipfd, (uint) cjpfd, ppfd);
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:5,代码来源:WinGraphicsMode.cs

示例13: GetAccelerationType

 static AccelerationType GetAccelerationType(ref PixelFormatDescriptor pfd)
 {
     AccelerationType type = AccelerationType.ICD;
     if ((pfd.Flags & PixelFormatDescriptorFlags.GENERIC_FORMAT) != 0)
     {
         if ((pfd.Flags & PixelFormatDescriptorFlags.GENERIC_ACCELERATED) != 0)
         {
             type = AccelerationType.MCD;
         }
         else
         {
             type = AccelerationType.None;
         }
     }
     return type;
 }
开发者ID:jpbruyere,项目名称:opentk,代码行数:16,代码来源:WinGraphicsMode.cs

示例14: ChoosePixelFormatPFD

        GraphicsMode ChoosePixelFormatPFD(IntPtr device, GraphicsMode mode, AccelerationType requested_acceleration_type)
        {
            PixelFormatDescriptor pfd = new PixelFormatDescriptor();
            PixelFormatDescriptorFlags flags = 0;
            flags |= PixelFormatDescriptorFlags.DRAW_TO_WINDOW;
            flags |= PixelFormatDescriptorFlags.SUPPORT_OPENGL;

            if (mode.Stereo)
            {
                flags |= PixelFormatDescriptorFlags.STEREO;
            }

            if (System.Environment.OSVersion.Version.Major >= 6 &&
                requested_acceleration_type != AccelerationType.None)
            {
                // Request a compositor-capable mode when running on
                // Vista+ and using hardware acceleration. Without this,
                // some modes will cause the compositor to turn off,
                // which is very annoying to the user.
                // Note: compositor-capable modes require hardware
                // acceleration. Don't set this flag when running
                // with software acceleration (e.g. over Remote Desktop
                // as described in bug https://github.com/opentk/opentk/issues/35)
                flags |= PixelFormatDescriptorFlags.SUPPORT_COMPOSITION;
            }

            int count = Functions.DescribePixelFormat(device, 1, API.PixelFormatDescriptorSize, ref pfd);

            int best = 0;
            int best_dist = int.MaxValue;
            for (int index = 1; index <= count; index++)
            {
                int dist = 0;
                bool valid = Functions.DescribePixelFormat(device, index, API.PixelFormatDescriptorSize, ref pfd) != 0;
                valid &= GetAccelerationType(ref pfd) == requested_acceleration_type;
                valid &= (pfd.Flags & flags) == flags;
                valid &= pfd.PixelType == PixelType.RGBA; // indexed modes not currently supported
                // heavily penalize single-buffered modes when the user requests double buffering
                if ((pfd.Flags & PixelFormatDescriptorFlags.DOUBLEBUFFER) == 0 && mode.Buffers > 1)
                    dist += 1000;
                valid &= Compare(pfd.ColorBits, mode.ColorFormat.BitsPerPixel, ref dist);
                valid &= Compare(pfd.RedBits, mode.ColorFormat.Red, ref dist);
                valid &= Compare(pfd.GreenBits, mode.ColorFormat.Green, ref dist);
                valid &= Compare(pfd.BlueBits, mode.ColorFormat.Blue, ref dist);
                valid &= Compare(pfd.AlphaBits, mode.ColorFormat.Alpha, ref dist);
                valid &= Compare(pfd.AccumBits, mode.AccumulatorFormat.BitsPerPixel, ref dist);
                valid &= Compare(pfd.AccumRedBits, mode.AccumulatorFormat.Red, ref dist);
                valid &= Compare(pfd.AccumGreenBits, mode.AccumulatorFormat.Green, ref dist);
                valid &= Compare(pfd.AccumBlueBits, mode.AccumulatorFormat.Blue, ref dist);
                valid &= Compare(pfd.AccumAlphaBits, mode.AccumulatorFormat.Alpha, ref dist);
                valid &= Compare(pfd.DepthBits, mode.Depth, ref dist);
                valid &= Compare(pfd.StencilBits, mode.Stencil, ref dist);

                if (valid && dist < best_dist)
                {
                    best = index;
                    best_dist = dist;
                }
            }

            return DescribePixelFormatPFD(device, ref pfd, best);
        }
开发者ID:jpbruyere,项目名称:opentk,代码行数:62,代码来源:WinGraphicsMode.cs

示例15: SetGraphicsModePFD

        // 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;
        }
开发者ID:shahid-pk,项目名称:opentk,代码行数:32,代码来源:WinGLContext.cs


注:本文中的OpenTK.Platform.Windows.PixelFormatDescriptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。