Removed unused WGL methods

WGL was autogenerated a few years ago but never touched after that.
Since we use a tiny fraction of all available methods, it makes sense to
remove the unused ones. This reduces dll size and improves startup
times.
This commit is contained in:
Stefanos A. 2013-11-28 23:22:35 +01:00
parent c53c0bc66f
commit 0a39143b3e
6 changed files with 157 additions and 978 deletions

View file

@ -1,299 +1,80 @@
#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
using System;
using System.Runtime.InteropServices;
using System.Security;
namespace OpenTK.Platform.Windows
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 3019
#pragma warning disable 1591
#pragma warning disable 3019
#pragma warning disable 1591
static partial class Wgl
{
public static
IntPtr CreateContext(IntPtr hDc)
{
return Delegates.wglCreateContext((IntPtr)hDc);
}
public static
Boolean DeleteContext(IntPtr oldContext)
{
return Delegates.wglDeleteContext((IntPtr)oldContext);
}
public static
IntPtr GetCurrentContext()
{
return Delegates.wglGetCurrentContext();
}
public static
Boolean MakeCurrent(IntPtr hDc, IntPtr newContext)
{
return Delegates.wglMakeCurrent((IntPtr)hDc, (IntPtr)newContext);
}
[System.CLSCompliant(false)]
public static
Boolean CopyContext(IntPtr hglrcSrc, IntPtr hglrcDst, UInt32 mask)
{
return Delegates.wglCopyContext((IntPtr)hglrcSrc, (IntPtr)hglrcDst, (UInt32)mask);
}
public static
Boolean CopyContext(IntPtr hglrcSrc, IntPtr hglrcDst, Int32 mask)
{
return Delegates.wglCopyContext((IntPtr)hglrcSrc, (IntPtr)hglrcDst, (UInt32)mask);
}
public static
int ChoosePixelFormat(IntPtr hDc, PixelFormatDescriptor[] pPfd)
{
unsafe
{
fixed (PixelFormatDescriptor* pPfd_ptr = pPfd)
{
return Delegates.wglChoosePixelFormat((IntPtr)hDc, (PixelFormatDescriptor*)pPfd_ptr);
}
}
}
public static
int ChoosePixelFormat(IntPtr hDc, ref PixelFormatDescriptor pPfd)
{
unsafe
{
fixed (PixelFormatDescriptor* pPfd_ptr = &pPfd)
{
return Delegates.wglChoosePixelFormat((IntPtr)hDc, (PixelFormatDescriptor*)pPfd_ptr);
}
}
}
[System.CLSCompliant(false)]
public static
unsafe int ChoosePixelFormat(IntPtr hDc, PixelFormatDescriptor* pPfd)
{
return Delegates.wglChoosePixelFormat((IntPtr)hDc, (PixelFormatDescriptor*)pPfd);
}
[System.CLSCompliant(false)]
public static
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);
}
}
}
public static
int DescribePixelFormat(IntPtr hdc, int ipfd, Int32 cjpfd, PixelFormatDescriptor[] ppfd)
{
unsafe
{
fixed (PixelFormatDescriptor* ppfd_ptr = ppfd)
{
return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd_ptr);
}
}
}
[System.CLSCompliant(false)]
public static
int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, ref PixelFormatDescriptor ppfd)
{
unsafe
{
fixed (PixelFormatDescriptor* ppfd_ptr = &ppfd)
{
return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd_ptr);
}
}
}
public static
int DescribePixelFormat(IntPtr hdc, int ipfd, Int32 cjpfd, ref PixelFormatDescriptor ppfd)
{
unsafe
{
fixed (PixelFormatDescriptor* ppfd_ptr = &ppfd)
{
return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd_ptr);
}
}
}
[System.CLSCompliant(false)]
public static
unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, PixelFormatDescriptor* ppfd)
{
return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd);
}
[System.CLSCompliant(false)]
public static
unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, Int32 cjpfd, PixelFormatDescriptor* ppfd)
{
return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd);
}
public static
IntPtr GetCurrentDC()
{
return Delegates.wglGetCurrentDC();
}
public static
IntPtr GetDefaultProcAddres(String lpszProc)
{
return Delegates.wglGetDefaultProcAddress((String)lpszProc);
}
public static
IntPtr GetProcAddres(String lpszProc)
{
return Delegates.wglGetProcAddress((String)lpszProc);
}
public static
int GetPixelFormat(IntPtr hdc)
{
return Delegates.wglGetPixelFormat((IntPtr)hdc);
}
public static
Boolean SetPixelFormat(IntPtr hdc, int ipfd, PixelFormatDescriptor[] ppfd)
{
unsafe
{
fixed (PixelFormatDescriptor* ppfd_ptr = ppfd)
{
return Delegates.wglSetPixelFormat((IntPtr)hdc, (int)ipfd, (PixelFormatDescriptor*)ppfd_ptr);
}
}
}
public static
Boolean SetPixelFormat(IntPtr hdc, int ipfd, ref PixelFormatDescriptor ppfd)
{
unsafe
{
fixed (PixelFormatDescriptor* ppfd_ptr = &ppfd)
{
return Delegates.wglSetPixelFormat((IntPtr)hdc, (int)ipfd, (PixelFormatDescriptor*)ppfd_ptr);
}
}
}
[System.CLSCompliant(false)]
public static
unsafe Boolean SetPixelFormat(IntPtr hdc, int ipfd, PixelFormatDescriptor* ppfd)
{
return Delegates.wglSetPixelFormat((IntPtr)hdc, (int)ipfd, (PixelFormatDescriptor*)ppfd);
}
public static
Boolean SwapBuffers(IntPtr hdc)
{
return Delegates.wglSwapBuffers((IntPtr)hdc);
}
public static
Boolean ShareLists(IntPtr hrcSrvShare, IntPtr hrcSrvSource)
{
return Delegates.wglShareLists((IntPtr)hrcSrvShare, (IntPtr)hrcSrvSource);
}
public static
Boolean MakeContextCurrentEXT(IntPtr hDrawDC, IntPtr hReadDC, IntPtr hglrc)
{
return Delegates.wglMakeContextCurrentEXT((IntPtr)hDrawDC, (IntPtr)hReadDC, (IntPtr)hglrc);
}
[System.CLSCompliant(false)]
public static
Boolean ChoosePixelFormatEXT(IntPtr hdc, int[] piAttribIList, Single[] pfAttribFList, UInt32 nMaxFormats, [Out] int[] piFormats, [Out] UInt32[] nNumFormats)
{
unsafe
{
fixed (int* piAttribIList_ptr = piAttribIList)
fixed (Single* pfAttribFList_ptr = pfAttribFList)
fixed (int* piFormats_ptr = piFormats)
fixed (UInt32* nNumFormats_ptr = nNumFormats)
{
return Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
}
}
}
public static
Boolean ChoosePixelFormatEXT(IntPtr hdc, int[] piAttribIList, Single[] pfAttribFList, Int32 nMaxFormats, [Out] int[] piFormats, [Out] Int32[] nNumFormats)
{
unsafe
{
fixed (int* piAttribIList_ptr = piAttribIList)
fixed (Single* pfAttribFList_ptr = pfAttribFList)
fixed (int* piFormats_ptr = piFormats)
fixed (Int32* nNumFormats_ptr = nNumFormats)
{
return Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
}
}
}
[System.CLSCompliant(false)]
public static
Boolean ChoosePixelFormatEXT(IntPtr hdc, ref int piAttribIList, ref Single pfAttribFList, UInt32 nMaxFormats, [Out] out int piFormats, [Out] out UInt32 nNumFormats)
{
unsafe
{
fixed (int* piAttribIList_ptr = &piAttribIList)
fixed (Single* pfAttribFList_ptr = &pfAttribFList)
fixed (int* piFormats_ptr = &piFormats)
fixed (UInt32* nNumFormats_ptr = &nNumFormats)
{
Boolean retval = Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
piFormats = *piFormats_ptr;
nNumFormats = *nNumFormats_ptr;
return retval;
}
}
}
public static
Boolean ChoosePixelFormatEXT(IntPtr hdc, ref int piAttribIList, ref Single pfAttribFList, Int32 nMaxFormats, [Out] out int piFormats, [Out] out Int32 nNumFormats)
{
unsafe
{
fixed (int* piAttribIList_ptr = &piAttribIList)
fixed (Single* pfAttribFList_ptr = &pfAttribFList)
fixed (int* piFormats_ptr = &piFormats)
fixed (Int32* nNumFormats_ptr = &nNumFormats)
{
Boolean retval = Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
piFormats = *piFormats_ptr;
nNumFormats = *nNumFormats_ptr;
return retval;
}
}
}
[System.CLSCompliant(false)]
public static
unsafe Boolean ChoosePixelFormatEXT(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32* nNumFormats)
{
return Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList, (Single*)pfAttribFList, (UInt32)nMaxFormats, (int*)piFormats, (UInt32*)nNumFormats);
}
[System.CLSCompliant(false)]
public static
unsafe Boolean ChoosePixelFormatEXT(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, Int32 nMaxFormats, [Out] int* piFormats, [Out] Int32* nNumFormats)
{
return Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList, (Single*)pfAttribFList, (UInt32)nMaxFormats, (int*)piFormats, (UInt32*)nNumFormats);
}
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglCreateContext", ExactSpelling = true, SetLastError = true)]
internal extern static IntPtr CreateContext(IntPtr hDc);
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglDeleteContext", ExactSpelling = true, SetLastError = true)]
internal extern static Boolean DeleteContext(IntPtr oldContext);
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglGetCurrentContext", ExactSpelling = true, SetLastError = true)]
internal extern static IntPtr GetCurrentContext();
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglMakeCurrent", ExactSpelling = true, SetLastError = true)]
internal extern static Boolean MakeCurrent(IntPtr hDc, IntPtr newContext);
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglCopyContext", ExactSpelling = true, SetLastError = true)]
internal extern static unsafe int ChoosePixelFormat(IntPtr hDc, ref PixelFormatDescriptor pPfd);
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglDescribePixelFormat", ExactSpelling = true, SetLastError = true)]
internal extern static unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, out PixelFormatDescriptor ppfd);
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglGetCurrentDC", ExactSpelling = true, SetLastError = true)]
internal extern static IntPtr GetCurrentDC();
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglGetProcAddress", ExactSpelling = true, SetLastError = true)]
internal extern static IntPtr GetProcAddress(String lpszProc);
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglGetProcAddress", ExactSpelling = true, SetLastError = true)]
internal extern static IntPtr GetProcAddress(IntPtr lpszProc);
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglGetPixelFormat", ExactSpelling = true, SetLastError = true)]
internal extern static int GetPixelFormat(IntPtr hdc);
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglSetPixelFormat", ExactSpelling = true, SetLastError = true)]
internal extern static Boolean SetPixelFormat(IntPtr hdc, int ipfd, ref PixelFormatDescriptor ppfd);
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglSwapBuffers", ExactSpelling = true, SetLastError = true)]
internal extern static Boolean SwapBuffers(IntPtr hdc);
[SuppressUnmanagedCodeSecurity]
[DllImport(Wgl.Library, EntryPoint = "wglShareLists", ExactSpelling = true, SetLastError = true)]
internal extern static Boolean ShareLists(IntPtr hrcSrvShare, IntPtr hrcSrvSource);
public static partial class Arb
{
@ -328,37 +109,6 @@ namespace OpenTK.Platform.Windows
}
}
[System.CLSCompliant(false)]
public static
IntPtr CreateBufferRegion(IntPtr hDC, int iLayerPlane, UInt32 uType)
{
return Delegates.wglCreateBufferRegionARB((IntPtr)hDC, (int)iLayerPlane, (UInt32)uType);
}
public static
IntPtr CreateBufferRegion(IntPtr hDC, int iLayerPlane, Int32 uType)
{
return Delegates.wglCreateBufferRegionARB((IntPtr)hDC, (int)iLayerPlane, (UInt32)uType);
}
public static
void DeleteBufferRegion(IntPtr hRegion)
{
Delegates.wglDeleteBufferRegionARB((IntPtr)hRegion);
}
public static
Boolean SaveBufferRegion(IntPtr hRegion, int x, int y, int width, int height)
{
return Delegates.wglSaveBufferRegionARB((IntPtr)hRegion, (int)x, (int)y, (int)width, (int)height);
}
public static
Boolean RestoreBufferRegion(IntPtr hRegion, int x, int y, int width, int height, int xSrc, int ySrc)
{
return Delegates.wglRestoreBufferRegionARB((IntPtr)hRegion, (int)x, (int)y, (int)width, (int)height, (int)xSrc, (int)ySrc);
}
public static
string GetExtensionsString(IntPtr hdc)
{
@ -368,20 +118,6 @@ namespace OpenTK.Platform.Windows
}
}
[System.CLSCompliant(false)]
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, int[] piAttributes, [Out] int[] piValues)
{
unsafe
{
fixed (int* piAttributes_ptr = piAttributes)
fixed (int* piValues_ptr = piValues)
{
return Delegates.wglGetPixelFormatAttribivARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
}
}
}
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, int[] piAttributes, [Out] int[] piValues)
{
@ -395,22 +131,6 @@ namespace OpenTK.Platform.Windows
}
}
[System.CLSCompliant(false)]
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, ref int piAttributes, [Out] out int piValues)
{
unsafe
{
fixed (int* piAttributes_ptr = &piAttributes)
fixed (int* piValues_ptr = &piValues)
{
Boolean retval = Delegates.wglGetPixelFormatAttribivARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
piValues = *piValues_ptr;
return retval;
}
}
}
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, ref int piAttributes, [Out] out int piValues)
{
@ -426,14 +146,6 @@ namespace OpenTK.Platform.Windows
}
}
[System.CLSCompliant(false)]
public static
unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, int* piAttributes, [Out] int* piValues)
{
return Delegates.wglGetPixelFormatAttribivARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (int*)piValues);
}
[System.CLSCompliant(false)]
public static
unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, int* piAttributes, [Out] int* piValues)
{
@ -467,22 +179,6 @@ namespace OpenTK.Platform.Windows
}
}
[System.CLSCompliant(false)]
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, ref int piAttributes, [Out] out Single pfValues)
{
unsafe
{
fixed (int* piAttributes_ptr = &piAttributes)
fixed (Single* pfValues_ptr = &pfValues)
{
Boolean retval = Delegates.wglGetPixelFormatAttribfvARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (Single*)pfValues_ptr);
pfValues = *pfValues_ptr;
return retval;
}
}
}
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, ref int piAttributes, [Out] out Single pfValues)
{
@ -498,13 +194,6 @@ namespace OpenTK.Platform.Windows
}
}
[System.CLSCompliant(false)]
public static
unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, int* piAttributes, [Out] Single* pfValues)
{
return Delegates.wglGetPixelFormatAttribfvARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (Single*)pfValues);
}
[System.CLSCompliant(false)]
public static
unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, int* piAttributes, [Out] Single* pfValues)
@ -512,22 +201,6 @@ namespace OpenTK.Platform.Windows
return Delegates.wglGetPixelFormatAttribfvARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (Single*)pfValues);
}
[System.CLSCompliant(false)]
public static
Boolean ChoosePixelFormat(IntPtr hdc, int[] piAttribIList, Single[] pfAttribFList, UInt32 nMaxFormats, [Out] int[] piFormats, [Out] UInt32[] nNumFormats)
{
unsafe
{
fixed (int* piAttribIList_ptr = piAttribIList)
fixed (Single* pfAttribFList_ptr = pfAttribFList)
fixed (int* piFormats_ptr = piFormats)
fixed (UInt32* nNumFormats_ptr = nNumFormats)
{
return Delegates.wglChoosePixelFormatARB((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
}
}
}
public static
Boolean ChoosePixelFormat(IntPtr hdc, int[] piAttribIList, Single[] pfAttribFList, Int32 nMaxFormats, [Out] int[] piFormats, [Out] Int32[] nNumFormats)
{
@ -543,25 +216,6 @@ namespace OpenTK.Platform.Windows
}
}
[System.CLSCompliant(false)]
public static
Boolean ChoosePixelFormat(IntPtr hdc, ref int piAttribIList, ref Single pfAttribFList, UInt32 nMaxFormats, [Out] out int piFormats, [Out] out UInt32 nNumFormats)
{
unsafe
{
fixed (int* piAttribIList_ptr = &piAttribIList)
fixed (Single* pfAttribFList_ptr = &pfAttribFList)
fixed (int* piFormats_ptr = &piFormats)
fixed (UInt32* nNumFormats_ptr = &nNumFormats)
{
Boolean retval = Delegates.wglChoosePixelFormatARB((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
piFormats = *piFormats_ptr;
nNumFormats = *nNumFormats_ptr;
return retval;
}
}
}
public static
Boolean ChoosePixelFormat(IntPtr hdc, ref int piAttribIList, ref Single pfAttribFList, Int32 nMaxFormats, [Out] out int piFormats, [Out] out Int32 nNumFormats)
{
@ -580,13 +234,6 @@ namespace OpenTK.Platform.Windows
}
}
[System.CLSCompliant(false)]
public static
unsafe Boolean ChoosePixelFormat(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32* nNumFormats)
{
return Delegates.wglChoosePixelFormatARB((IntPtr)hdc, (int*)piAttribIList, (Single*)pfAttribFList, (UInt32)nMaxFormats, (int*)piFormats, (UInt32*)nNumFormats);
}
[System.CLSCompliant(false)]
public static
unsafe Boolean ChoosePixelFormat(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, Int32 nMaxFormats, [Out] int* piFormats, [Out] Int32* nNumFormats)
@ -730,114 +377,10 @@ namespace OpenTK.Platform.Windows
{
return Delegates.wglSetPbufferAttribARB((IntPtr)hPbuffer, (int*)piAttribList);
}
}
public static partial class Ext
{
[System.CLSCompliant(false)]
public static
bool CreateDisplayColorTable(UInt16 id)
{
return Delegates.wglCreateDisplayColorTableEXT((UInt16)id);
}
public static
bool CreateDisplayColorTable(Int16 id)
{
return Delegates.wglCreateDisplayColorTableEXT((UInt16)id);
}
[System.CLSCompliant(false)]
public static
bool LoadDisplayColorTable(UInt16[] table, UInt32 length)
{
unsafe
{
fixed (UInt16* table_ptr = table)
{
return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table_ptr, (UInt32)length);
}
}
}
public static
bool LoadDisplayColorTable(Int16[] table, Int32 length)
{
unsafe
{
fixed (Int16* table_ptr = table)
{
return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table_ptr, (UInt32)length);
}
}
}
[System.CLSCompliant(false)]
public static
bool LoadDisplayColorTable(ref UInt16 table, UInt32 length)
{
unsafe
{
fixed (UInt16* table_ptr = &table)
{
return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table_ptr, (UInt32)length);
}
}
}
public static
bool LoadDisplayColorTable(ref Int16 table, Int32 length)
{
unsafe
{
fixed (Int16* table_ptr = &table)
{
return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table_ptr, (UInt32)length);
}
}
}
[System.CLSCompliant(false)]
public static
unsafe bool LoadDisplayColorTable(UInt16* table, UInt32 length)
{
return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table, (UInt32)length);
}
[System.CLSCompliant(false)]
public static
unsafe bool LoadDisplayColorTable(Int16* table, Int32 length)
{
return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table, (UInt32)length);
}
[System.CLSCompliant(false)]
public static
bool BindDisplayColorTable(UInt16 id)
{
return Delegates.wglBindDisplayColorTableEXT((UInt16)id);
}
public static
bool BindDisplayColorTable(Int16 id)
{
return Delegates.wglBindDisplayColorTableEXT((UInt16)id);
}
[System.CLSCompliant(false)]
public static
void DestroyDisplayColorTable(UInt16 id)
{
Delegates.wglDestroyDisplayColorTableEXT((UInt16)id);
}
public static
void DestroyDisplayColorTable(Int16 id)
{
Delegates.wglDestroyDisplayColorTableEXT((UInt16)id);
}
public static
string GetExtensionsString()
{
@ -847,242 +390,6 @@ namespace OpenTK.Platform.Windows
}
}
public static
IntPtr GetCurrentReadDC()
{
return Delegates.wglGetCurrentReadDCEXT();
}
public static
IntPtr CreatePbuffer(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, int[] piAttribList)
{
unsafe
{
fixed (int* piAttribList_ptr = piAttribList)
{
return Delegates.wglCreatePbufferEXT((IntPtr)hDC, (int)iPixelFormat, (int)iWidth, (int)iHeight, (int*)piAttribList_ptr);
}
}
}
public static
IntPtr CreatePbuffer(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, ref int piAttribList)
{
unsafe
{
fixed (int* piAttribList_ptr = &piAttribList)
{
return Delegates.wglCreatePbufferEXT((IntPtr)hDC, (int)iPixelFormat, (int)iWidth, (int)iHeight, (int*)piAttribList_ptr);
}
}
}
[System.CLSCompliant(false)]
public static
unsafe IntPtr CreatePbuffer(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, int* piAttribList)
{
return Delegates.wglCreatePbufferEXT((IntPtr)hDC, (int)iPixelFormat, (int)iWidth, (int)iHeight, (int*)piAttribList);
}
public static
IntPtr GetPbufferDC(IntPtr hPbuffer)
{
return Delegates.wglGetPbufferDCEXT((IntPtr)hPbuffer);
}
public static
int ReleasePbufferDC(IntPtr hPbuffer, IntPtr hDC)
{
return Delegates.wglReleasePbufferDCEXT((IntPtr)hPbuffer, (IntPtr)hDC);
}
public static
Boolean DestroyPbuffer(IntPtr hPbuffer)
{
return Delegates.wglDestroyPbufferEXT((IntPtr)hPbuffer);
}
public static
Boolean QueryPbuffer(IntPtr hPbuffer, int iAttribute, [Out] int[] piValue)
{
unsafe
{
fixed (int* piValue_ptr = piValue)
{
return Delegates.wglQueryPbufferEXT((IntPtr)hPbuffer, (int)iAttribute, (int*)piValue_ptr);
}
}
}
public static
Boolean QueryPbuffer(IntPtr hPbuffer, int iAttribute, [Out] out int piValue)
{
unsafe
{
fixed (int* piValue_ptr = &piValue)
{
Boolean retval = Delegates.wglQueryPbufferEXT((IntPtr)hPbuffer, (int)iAttribute, (int*)piValue_ptr);
piValue = *piValue_ptr;
return retval;
}
}
}
[System.CLSCompliant(false)]
public static
unsafe Boolean QueryPbuffer(IntPtr hPbuffer, int iAttribute, [Out] int* piValue)
{
return Delegates.wglQueryPbufferEXT((IntPtr)hPbuffer, (int)iAttribute, (int*)piValue);
}
[System.CLSCompliant(false)]
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int[] piAttributes, [Out] int[] piValues)
{
unsafe
{
fixed (int* piAttributes_ptr = piAttributes)
fixed (int* piValues_ptr = piValues)
{
return Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
}
}
}
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] int[] piAttributes, [Out] int[] piValues)
{
unsafe
{
fixed (int* piAttributes_ptr = piAttributes)
fixed (int* piValues_ptr = piValues)
{
return Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
}
}
}
[System.CLSCompliant(false)]
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] out int piAttributes, [Out] out int piValues)
{
unsafe
{
fixed (int* piAttributes_ptr = &piAttributes)
fixed (int* piValues_ptr = &piValues)
{
Boolean retval = Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
piAttributes = *piAttributes_ptr;
piValues = *piValues_ptr;
return retval;
}
}
}
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] out int piAttributes, [Out] out int piValues)
{
unsafe
{
fixed (int* piAttributes_ptr = &piAttributes)
fixed (int* piValues_ptr = &piValues)
{
Boolean retval = Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
piAttributes = *piAttributes_ptr;
piValues = *piValues_ptr;
return retval;
}
}
}
[System.CLSCompliant(false)]
public static
unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] int* piValues)
{
return Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (int*)piValues);
}
[System.CLSCompliant(false)]
public static
unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] int* piAttributes, [Out] int* piValues)
{
return Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (int*)piValues);
}
[System.CLSCompliant(false)]
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int[] piAttributes, [Out] Single[] pfValues)
{
unsafe
{
fixed (int* piAttributes_ptr = piAttributes)
fixed (Single* pfValues_ptr = pfValues)
{
return Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (Single*)pfValues_ptr);
}
}
}
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] int[] piAttributes, [Out] Single[] pfValues)
{
unsafe
{
fixed (int* piAttributes_ptr = piAttributes)
fixed (Single* pfValues_ptr = pfValues)
{
return Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (Single*)pfValues_ptr);
}
}
}
[System.CLSCompliant(false)]
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] out int piAttributes, [Out] out Single pfValues)
{
unsafe
{
fixed (int* piAttributes_ptr = &piAttributes)
fixed (Single* pfValues_ptr = &pfValues)
{
Boolean retval = Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (Single*)pfValues_ptr);
piAttributes = *piAttributes_ptr;
pfValues = *pfValues_ptr;
return retval;
}
}
}
public static
Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] out int piAttributes, [Out] out Single pfValues)
{
unsafe
{
fixed (int* piAttributes_ptr = &piAttributes)
fixed (Single* pfValues_ptr = &pfValues)
{
Boolean retval = Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (Single*)pfValues_ptr);
piAttributes = *piAttributes_ptr;
pfValues = *pfValues_ptr;
return retval;
}
}
}
[System.CLSCompliant(false)]
public static
unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] Single* pfValues)
{
return Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (Single*)pfValues);
}
[System.CLSCompliant(false)]
public static
unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] int* piAttributes, [Out] Single* pfValues)
{
return Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (Single*)pfValues);
}
public static
Boolean SwapInterval(int interval)
{

View file

@ -1,52 +0,0 @@
namespace OpenTK.Platform.Windows
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 3019
#pragma warning disable 1591
partial class Wgl
{
internal static partial class Imports
{
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglCreateContext", ExactSpelling = true, SetLastError=true)]
internal extern static IntPtr CreateContext(IntPtr hDc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglDeleteContext", ExactSpelling = true, SetLastError = true)]
internal extern static Boolean DeleteContext(IntPtr oldContext);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetCurrentContext", ExactSpelling = true, SetLastError=true)]
internal extern static IntPtr GetCurrentContext();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglMakeCurrent", ExactSpelling = true, SetLastError=true)]
internal extern static Boolean MakeCurrent(IntPtr hDc, IntPtr newContext);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglCopyContext", ExactSpelling = true, SetLastError = true)]
internal extern static unsafe int ChoosePixelFormat(IntPtr hDc, PixelFormatDescriptor* pPfd);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglDescribePixelFormat", ExactSpelling = true, SetLastError = true)]
internal extern static unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, PixelFormatDescriptor* ppfd);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetCurrentDC", ExactSpelling = true, SetLastError = true)]
internal extern static IntPtr GetCurrentDC();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetProcAddress", ExactSpelling = true, SetLastError = true)]
internal extern static IntPtr GetProcAddress(String lpszProc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetPixelFormat", ExactSpelling = true, SetLastError = true)]
internal extern static int GetPixelFormat(IntPtr hdc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSetPixelFormat", ExactSpelling = true, SetLastError = true)]
internal extern static unsafe Boolean SetPixelFormat(IntPtr hdc, int ipfd, PixelFormatDescriptor* ppfd);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSwapBuffers", ExactSpelling = true, SetLastError = true)]
internal extern static Boolean SwapBuffers(IntPtr hdc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglShareLists", ExactSpelling = true, SetLastError = true)]
internal extern static Boolean ShareLists(IntPtr hrcSrvShare, IntPtr hrcSrvSource);
}
}
}

View file

@ -1,3 +1,30 @@
#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;
@ -10,64 +37,10 @@ namespace OpenTK.Platform.Windows
{
internal static partial class Delegates
{
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr CreateContext(IntPtr hDc);
internal static CreateContext wglCreateContext;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Boolean DeleteContext(IntPtr oldContext);
internal static DeleteContext wglDeleteContext;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr GetCurrentContext();
internal static GetCurrentContext wglGetCurrentContext;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Boolean MakeCurrent(IntPtr hDc, IntPtr newContext);
internal static MakeCurrent wglMakeCurrent;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Boolean CopyContext(IntPtr hglrcSrc, IntPtr hglrcDst, UInt32 mask);
internal static CopyContext wglCopyContext;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int ChoosePixelFormat(IntPtr hDc, PixelFormatDescriptor* pPfd);
internal unsafe static ChoosePixelFormat wglChoosePixelFormat;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, PixelFormatDescriptor* ppfd);
internal unsafe static DescribePixelFormat wglDescribePixelFormat;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr GetCurrentDC();
internal static GetCurrentDC wglGetCurrentDC;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr GetDefaultProcAddress(String lpszProc);
internal static GetDefaultProcAddress wglGetDefaultProcAddress;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr GetProcAddress(String lpszProc);
internal static GetProcAddress wglGetProcAddress;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int GetPixelFormat(IntPtr hdc);
internal static GetPixelFormat wglGetPixelFormat;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Boolean SetPixelFormat(IntPtr hdc, int ipfd, PixelFormatDescriptor* ppfd);
internal unsafe static SetPixelFormat wglSetPixelFormat;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Boolean SwapBuffers(IntPtr hdc);
internal static SwapBuffers wglSwapBuffers;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Boolean ShareLists(IntPtr hrcSrvShare, IntPtr hrcSrvSource);
internal static ShareLists wglShareLists;
[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 CreateBufferRegionARB(IntPtr hDC, int iLayerPlane, UInt32 uType);
internal static CreateBufferRegionARB wglCreateBufferRegionARB;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DeleteBufferRegionARB(IntPtr hRegion);
internal static DeleteBufferRegionARB wglDeleteBufferRegionARB;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Boolean SaveBufferRegionARB(IntPtr hRegion, int x, int y, int width, int height);
internal static SaveBufferRegionARB wglSaveBufferRegionARB;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Boolean RestoreBufferRegionARB(IntPtr hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
internal static RestoreBufferRegionARB wglRestoreBufferRegionARB;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr GetExtensionsStringARB(IntPtr hdc);
internal static GetExtensionsStringARB wglGetExtensionsStringARB;
[System.Security.SuppressUnmanagedCodeSecurity()]
@ -110,51 +83,9 @@ namespace OpenTK.Platform.Windows
internal unsafe delegate Boolean SetPbufferAttribARB(IntPtr hPbuffer, int* piAttribList);
internal unsafe static SetPbufferAttribARB wglSetPbufferAttribARB;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate bool CreateDisplayColorTableEXT(UInt16 id);
internal static CreateDisplayColorTableEXT wglCreateDisplayColorTableEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate bool LoadDisplayColorTableEXT(UInt16* table, UInt32 length);
internal unsafe static LoadDisplayColorTableEXT wglLoadDisplayColorTableEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate bool BindDisplayColorTableEXT(UInt16 id);
internal static BindDisplayColorTableEXT wglBindDisplayColorTableEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DestroyDisplayColorTableEXT(UInt16 id);
internal static DestroyDisplayColorTableEXT wglDestroyDisplayColorTableEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr GetExtensionsStringEXT();
internal static GetExtensionsStringEXT wglGetExtensionsStringEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Boolean MakeContextCurrentEXT(IntPtr hDrawDC, IntPtr hReadDC, IntPtr hglrc);
internal static MakeContextCurrentEXT wglMakeContextCurrentEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr GetCurrentReadDCEXT();
internal static GetCurrentReadDCEXT wglGetCurrentReadDCEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreatePbufferEXT(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, int* piAttribList);
internal unsafe static CreatePbufferEXT wglCreatePbufferEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr GetPbufferDCEXT(IntPtr hPbuffer);
internal static GetPbufferDCEXT wglGetPbufferDCEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleasePbufferDCEXT(IntPtr hPbuffer, IntPtr hDC);
internal static ReleasePbufferDCEXT wglReleasePbufferDCEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Boolean DestroyPbufferEXT(IntPtr hPbuffer);
internal static DestroyPbufferEXT wglDestroyPbufferEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Boolean QueryPbufferEXT(IntPtr hPbuffer, int iAttribute, [Out] int* piValue);
internal unsafe static QueryPbufferEXT wglQueryPbufferEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Boolean GetPixelFormatAttribivEXT(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] int* piValues);
internal unsafe static GetPixelFormatAttribivEXT wglGetPixelFormatAttribivEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Boolean GetPixelFormatAttribfvEXT(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] Single* pfValues);
internal unsafe static GetPixelFormatAttribfvEXT wglGetPixelFormatAttribfvEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Boolean ChoosePixelFormatEXT(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32* nNumFormats);
internal unsafe static ChoosePixelFormatEXT wglChoosePixelFormatEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Boolean SwapIntervalEXT(int interval);
internal static SwapIntervalEXT wglSwapIntervalEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]

View file

@ -22,7 +22,6 @@ namespace OpenTK.Platform.Windows
assembly = Assembly.GetExecutingAssembly();
wglClass = assembly.GetType("OpenTK.Platform.Windows.Wgl");
delegatesClass = wglClass.GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic);
importsClass = wglClass.GetNestedType("Imports", BindingFlags.Static | BindingFlags.NonPublic);
//// Ensure core entry points are ready prior to accessing any method.
//// Resolves bug [#993]: "Possible bug in GraphicsContext.CreateDummyContext()"
@ -38,7 +37,6 @@ namespace OpenTK.Platform.Windows
private static Assembly assembly;
private static Type wglClass;
private static Type delegatesClass;
private static Type importsClass;
private static bool rebuildExtensionList = true;
@ -59,16 +57,7 @@ namespace OpenTK.Platform.Windows
/// </returns>
static Delegate LoadDelegate(string name, Type signature)
{
Delegate d;
string realName = name.StartsWith("wgl") ? name.Substring(3) : name;
if (importsClass.GetMethod(realName,
BindingFlags.NonPublic | BindingFlags.Static) != null)
d = GetExtensionDelegate(name, signature) ??
Delegate.CreateDelegate(signature, typeof(Imports), realName);
else
d = GetExtensionDelegate(name, signature);
Delegate d = GetExtensionDelegate(name, signature);
return d;
}
@ -87,7 +76,7 @@ namespace OpenTK.Platform.Windows
/// </returns>
private static Delegate GetExtensionDelegate(string name, Type signature)
{
IntPtr address = Imports.GetProcAddress(name);
IntPtr address = GetProcAddress(name);
if (address == IntPtr.Zero ||
address == new IntPtr(1) || // Workaround for buggy nvidia drivers which return

View file

@ -68,7 +68,7 @@ namespace OpenTK.Platform.Windows
SetGraphicsModePFD(selector, GraphicsMode.Default, window);
// Then, construct a temporary context and load all wgl extensions
ContextHandle temp_context = new ContextHandle(Wgl.Imports.CreateContext(window.DeviceContext));
ContextHandle temp_context = new ContextHandle(Wgl.CreateContext(window.DeviceContext));
if (temp_context != ContextHandle.Zero)
{
// Make the context current.
@ -79,7 +79,7 @@ namespace OpenTK.Platform.Windows
// Sigh...
for (int retry = 0; retry < 5; retry++)
{
bool success = Wgl.Imports.MakeCurrent(window.DeviceContext, temp_context.Handle);
bool success = Wgl.MakeCurrent(window.DeviceContext, temp_context.Handle);
if (!success)
{
Debug.Print("wglMakeCurrent failed with error: {0}. Retrying", Marshal.GetLastWin32Error());
@ -94,8 +94,8 @@ namespace OpenTK.Platform.Windows
// Load wgl extensions and destroy temporary context
Wgl.LoadAll();
Wgl.Imports.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
Wgl.Imports.DeleteContext(temp_context.Handle);
Wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
Wgl.DeleteContext(temp_context.Handle);
}
else
{
@ -168,9 +168,9 @@ namespace OpenTK.Platform.Windows
{
// Failed to create GL3-level context, fall back to GL2.
Debug.Write("Falling back to GL2... ");
Handle = new ContextHandle(Wgl.Imports.CreateContext(window.DeviceContext));
Handle = new ContextHandle(Wgl.CreateContext(window.DeviceContext));
if (Handle == ContextHandle.Zero)
Handle = new ContextHandle(Wgl.Imports.CreateContext(window.DeviceContext));
Handle = new ContextHandle(Wgl.CreateContext(window.DeviceContext));
if (Handle == ContextHandle.Zero)
throw new GraphicsContextException(
String.Format("Context creation failed. Wgl.CreateContext() error: {0}.",
@ -193,7 +193,7 @@ namespace OpenTK.Platform.Windows
{
Marshal.GetLastWin32Error();
Debug.Write(String.Format("Sharing state with context {0}: ", sharedContext));
bool result = Wgl.Imports.ShareLists((sharedContext as IGraphicsContextInternal).Context.Handle, Handle.Handle);
bool result = Wgl.ShareLists((sharedContext as IGraphicsContextInternal).Context.Handle, Handle.Handle);
Debug.WriteLine(result ? "success!" : "failed with win32 error " + Marshal.GetLastWin32Error());
}
}
@ -255,11 +255,11 @@ namespace OpenTK.Platform.Windows
if (wnd.Handle == IntPtr.Zero)
throw new ArgumentException("window", "Must point to a valid window.");
success = Wgl.Imports.MakeCurrent(wnd.DeviceContext, Handle.Handle);
success = Wgl.MakeCurrent(wnd.DeviceContext, Handle.Handle);
}
else
{
success = Wgl.Imports.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
success = Wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
}
if (!success)
@ -274,7 +274,7 @@ namespace OpenTK.Platform.Windows
public override bool IsCurrent
{
get { return Wgl.Imports.GetCurrentContext() == Handle.Handle; }
get { return Wgl.GetCurrentContext() == Handle.Handle; }
}
#endregion
@ -338,7 +338,17 @@ namespace OpenTK.Platform.Windows
public override IntPtr GetAddress(string function_string)
{
IntPtr address = Wgl.Imports.GetProcAddress(function_string);
IntPtr address = Wgl.GetProcAddress(function_string);
if (!IsValid(address))
{
address = Functions.GetProcAddress(opengl32Handle, function_string);
}
return address;
}
public override IntPtr GetAddress(IntPtr function_string)
{
IntPtr address = Wgl.GetProcAddress(function_string);
if (!IsValid(address))
{
address = Functions.GetProcAddress(opengl32Handle, function_string);
@ -403,7 +413,7 @@ namespace OpenTK.Platform.Windows
{
get
{
return Wgl.Imports.GetCurrentDC();
return Wgl.GetCurrentDC();
}
}
@ -462,7 +472,7 @@ namespace OpenTK.Platform.Windows
try
{
// This will fail if the user calls Dispose() on thread X when the context is current on thread Y.
if (!Wgl.Imports.DeleteContext(Handle.Handle))
if (!Wgl.DeleteContext(Handle.Handle))
Debug.Print("Failed to destroy OpenGL context {0}. Error: {1}",
Handle.ToString(), Marshal.GetLastWin32Error());
}

View file

@ -109,15 +109,9 @@ namespace OpenTK.Platform.Windows
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);
}
}
// Note: DescribePixelFormat found in gdi32 is extremely slow
// on nvidia, for some reason.
return Wgl.DescribePixelFormat(hdc, ipfd, (uint)cjpfd, out pfd);
}
#endregion