From 8bcbb06f8eb9f89bbe35183646a102df6711339b Mon Sep 17 00:00:00 2001 From: thefiddler Date: Sat, 28 Dec 2013 01:08:24 +0100 Subject: [PATCH] [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. --- Source/OpenTK/Platform/Utilities.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Source/OpenTK/Platform/Utilities.cs b/Source/OpenTK/Platform/Utilities.cs index 4ed38158..67c92a78 100644 --- a/Source/OpenTK/Platform/Utilities.cs +++ b/Source/OpenTK/Platform/Utilities.cs @@ -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 --- ///