diff --git a/Source/OpenTK/OpenTK.csproj b/Source/OpenTK/OpenTK.csproj index 8c3931fc..4ee4c230 100644 --- a/Source/OpenTK/OpenTK.csproj +++ b/Source/OpenTK/OpenTK.csproj @@ -372,9 +372,6 @@ Code - - Code - Code diff --git a/Source/OpenTK/Platform/Windows/Bindings/WglDelegates.cs b/Source/OpenTK/Platform/Windows/Bindings/WglDelegates.cs deleted file mode 100644 index 0a3cc695..00000000 --- a/Source/OpenTK/Platform/Windows/Bindings/WglDelegates.cs +++ /dev/null @@ -1,96 +0,0 @@ -#region License -// -// The Open Toolkit Library License -// -// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -// the Software, and to permit persons to whom the Software is furnished to do -// so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -#endregion - -namespace OpenTK.Platform.Windows -{ - using System; - using System.Runtime.InteropServices; - #pragma warning disable 0649 - #pragma warning disable 3019 - #pragma warning disable 1591 - - partial class Wgl - { - internal static partial class Delegates - { - [System.Security.SuppressUnmanagedCodeSecurity()] - internal unsafe delegate IntPtr CreateContextAttribsARB(IntPtr hDC, IntPtr hShareContext, int* attribList); - internal unsafe static CreateContextAttribsARB wglCreateContextAttribsARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal delegate IntPtr GetExtensionsStringARB(IntPtr hdc); - internal static GetExtensionsStringARB wglGetExtensionsStringARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal unsafe delegate Boolean GetPixelFormatAttribivARB(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, int* piAttributes, [Out] int* piValues); - internal unsafe static GetPixelFormatAttribivARB wglGetPixelFormatAttribivARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal unsafe delegate Boolean GetPixelFormatAttribfvARB(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, int* piAttributes, [Out] Single* pfValues); - internal unsafe static GetPixelFormatAttribfvARB wglGetPixelFormatAttribfvARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal unsafe delegate Boolean ChoosePixelFormatARB(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32* nNumFormats); - internal unsafe static ChoosePixelFormatARB wglChoosePixelFormatARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal delegate Boolean MakeContextCurrentARB(IntPtr hDrawDC, IntPtr hReadDC, IntPtr hglrc); - internal static MakeContextCurrentARB wglMakeContextCurrentARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal delegate IntPtr GetCurrentReadDCARB(); - internal static GetCurrentReadDCARB wglGetCurrentReadDCARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal unsafe delegate IntPtr CreatePbufferARB(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, int* piAttribList); - internal unsafe static CreatePbufferARB wglCreatePbufferARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal delegate IntPtr GetPbufferDCARB(IntPtr hPbuffer); - internal static GetPbufferDCARB wglGetPbufferDCARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal delegate int ReleasePbufferDCARB(IntPtr hPbuffer, IntPtr hDC); - internal static ReleasePbufferDCARB wglReleasePbufferDCARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal delegate Boolean DestroyPbufferARB(IntPtr hPbuffer); - internal static DestroyPbufferARB wglDestroyPbufferARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal unsafe delegate Boolean QueryPbufferARB(IntPtr hPbuffer, int iAttribute, [Out] int* piValue); - internal unsafe static QueryPbufferARB wglQueryPbufferARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal delegate Boolean BindTexImageARB(IntPtr hPbuffer, int iBuffer); - internal static BindTexImageARB wglBindTexImageARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal delegate Boolean ReleaseTexImageARB(IntPtr hPbuffer, int iBuffer); - internal static ReleaseTexImageARB wglReleaseTexImageARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal unsafe delegate Boolean SetPbufferAttribARB(IntPtr hPbuffer, int* piAttribList); - internal unsafe static SetPbufferAttribARB wglSetPbufferAttribARB; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal delegate IntPtr GetExtensionsStringEXT(); - internal static GetExtensionsStringEXT wglGetExtensionsStringEXT; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal delegate Boolean SwapIntervalEXT(int interval); - internal static SwapIntervalEXT wglSwapIntervalEXT; - [System.Security.SuppressUnmanagedCodeSecurity()] - internal delegate int GetSwapIntervalEXT(); - internal static GetSwapIntervalEXT wglGetSwapIntervalEXT; - } - } -} diff --git a/Source/OpenTK/Platform/Windows/WinGLContext.cs b/Source/OpenTK/Platform/Windows/WinGLContext.cs index af55d3e5..ae1828e4 100644 --- a/Source/OpenTK/Platform/Windows/WinGLContext.cs +++ b/Source/OpenTK/Platform/Windows/WinGLContext.cs @@ -128,7 +128,7 @@ namespace OpenTK.Platform.Windows current_context = Wgl.GetCurrentContext(); if (current_context != IntPtr.Zero && current_context == temp_context.Context.Handle) { - Wgl.LoadAll(); + new Wgl().LoadEntryPoints(); } } @@ -138,7 +138,7 @@ namespace OpenTK.Platform.Windows ModeSelector = new WinGraphicsMode(window.DeviceContext); Mode = SetGraphicsModePFD(ModeSelector, format, (WinWindowInfo)window); - if (Wgl.Delegates.wglCreateContextAttribsARB != null) + if (Wgl.SupportsFunction("wglCreateContextAttribsARB")) { try { @@ -213,7 +213,7 @@ namespace OpenTK.Platform.Windows // using the new entry points.) // Sigh... MakeCurrent(window); - Wgl.LoadAll(); + new Wgl().LoadEntryPoints(); if (sharedContext != null) { @@ -345,10 +345,11 @@ namespace OpenTK.Platform.Windows { lock (LoadLock) { - Wgl.LoadAll(); + new Wgl().LoadEntryPoints(); vsync_supported = Wgl.SupportsExtension(DeviceContext, "WGL_EXT_swap_control") && - Wgl.Load("wglGetSwapIntervalEXT") && Wgl.Load("wglSwapIntervalEXT"); + Wgl.SupportsFunction("wglGetSwapIntervalEXT") && + Wgl.SupportsFunction("wglSwapIntervalEXT"); vsync_tear_supported = Wgl.SupportsExtension(DeviceContext, "WGL_EXT_swap_tear"); } diff --git a/Source/OpenTK/Platform/Windows/WinGraphicsMode.cs b/Source/OpenTK/Platform/Windows/WinGraphicsMode.cs index 1fc3954d..1a97fa72 100644 --- a/Source/OpenTK/Platform/Windows/WinGraphicsMode.cs +++ b/Source/OpenTK/Platform/Windows/WinGraphicsMode.cs @@ -100,7 +100,7 @@ namespace OpenTK.Platform.Windows { GraphicsMode created_mode = null; if (Wgl.SupportsExtension("WGL_ARB_pixel_format") && - Wgl.Delegates.wglChoosePixelFormatARB != null) + Wgl.SupportsFunction("wglChoosePixelFormatARB")) { List attributes = new List(); attributes.Add((int)WGL_ARB_pixel_format.AccelerationArb); @@ -357,7 +357,7 @@ namespace OpenTK.Platform.Windows { GraphicsMode created_mode = null; // See http://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt for more details - if (Wgl.Delegates.wglGetPixelFormatAttribivARB != null) + if (Wgl.SupportsFunction("wglGetPixelFormatAttribivARB")) { // Define the list of attributes we are interested in. // The results will be stored in the 'values' array below.