From 44b8a9dbdcf2c44d1888b38c8bce9fe2e0821245 Mon Sep 17 00:00:00 2001 From: "Stefanos A." Date: Tue, 17 Dec 2013 22:35:30 +0100 Subject: [PATCH] Use gdi32 implementations of functions Several functions are defined in both gdi32 and opengl32. Using the opengl32/wgl versions did not appear to help with issue #19. Let's use the gdi32 version instead, as suggested here: https://www.opengl.org/wiki/Platform_specifics:_Windows#The_WGL_functions --- Source/OpenTK/Platform/Windows/WinGLContext.cs | 6 +++--- Source/OpenTK/Platform/Windows/WinGraphicsMode.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/OpenTK/Platform/Windows/WinGLContext.cs b/Source/OpenTK/Platform/Windows/WinGLContext.cs index bfe4c9d1..92c21851 100644 --- a/Source/OpenTK/Platform/Windows/WinGLContext.cs +++ b/Source/OpenTK/Platform/Windows/WinGLContext.cs @@ -376,13 +376,13 @@ namespace OpenTK.Platform.Windows } PixelFormatDescriptor pfd = new PixelFormatDescriptor(); - Wgl.DescribePixelFormat( + Functions.DescribePixelFormat( window.DeviceContext, (int)mode.Index.Value, API.PixelFormatDescriptorSize, ref pfd); Debug.WriteLine(mode.Index.ToString()); - - if (!Wgl.SetPixelFormat(window.DeviceContext, (int)mode.Index.Value, ref pfd)) + + if (!Functions.SetPixelFormat(window.DeviceContext, (int)mode.Index.Value, ref pfd)) { throw new GraphicsContextException(String.Format( "Requested GraphicsMode not available. SetPixelFormat error: {0}", diff --git a/Source/OpenTK/Platform/Windows/WinGraphicsMode.cs b/Source/OpenTK/Platform/Windows/WinGraphicsMode.cs index f62f2315..b2826b5e 100644 --- a/Source/OpenTK/Platform/Windows/WinGraphicsMode.cs +++ b/Source/OpenTK/Platform/Windows/WinGraphicsMode.cs @@ -131,7 +131,7 @@ namespace OpenTK.Platform.Windows // This should fix issue #2224, which causes OpenTK to fail on VMs without hardware acceleration. // Note: DescribePixelFormat found in gdi32 is extremely slow on nvidia, for some reason. int pixel = 0; - while (Wgl.DescribePixelFormat(device, ++pixel, API.PixelFormatDescriptorSize, ref pfd) != 0) + while (Functions.DescribePixelFormat(device, ++pixel, API.PixelFormatDescriptorSize, ref pfd) != 0) { // Ignore non-accelerated formats. if (!generic_allowed && (pfd.Flags & PixelFormatDescriptorFlags.GENERIC_FORMAT) != 0)