[Platform] Added internal CreateGetAddress() function

CreateGetAddress() constructs a GraphicsContext.GetAddressDelegate that
is suitable for the current platform. This can be used when combining
OpenTK with an OpenGL context created through a third-party toolkit.
This commit is contained in:
thefiddler 2013-12-28 01:08:24 +01:00
parent cf76aa6085
commit 8bcbb06f8e

View file

@ -170,6 +170,32 @@ namespace OpenTK.Platform
#endregion
#region CreateGetAddress
internal static GraphicsContext.GetAddressDelegate CreateGetAddress()
{
GraphicsContext.GetAddressDelegate loader = null;
if (Configuration.RunningOnWindows)
{
loader = Platform.Windows.Wgl.GetProcAddress;
}
else if (Configuration.RunningOnX11)
{
loader = Platform.X11.Glx.GetProcAddress;
}
else if (Configuration.RunningOnMacOS)
{
loader = Platform.MacOS.NS.GetAddress;
}
else
{
throw new PlatformNotSupportedException();
}
return loader;
}
#endregion
#region --- Creating a Graphics Context ---
/// <summary>