From 8921547dae861ec505992d7c8bfb6ea633877118 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Wed, 1 Aug 2007 09:30:14 +0000 Subject: [PATCH] Synced with gl3 branch. --- Source/OpenTK/OpenGL/DisplayList.cs | 5 ++--- Source/OpenTK/OpenGL/GLHelper.cs | 26 +++++++++++++++++--------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Source/OpenTK/OpenGL/DisplayList.cs b/Source/OpenTK/OpenGL/DisplayList.cs index 8faa4305..5baffbee 100644 --- a/Source/OpenTK/OpenGL/DisplayList.cs +++ b/Source/OpenTK/OpenGL/DisplayList.cs @@ -4,7 +4,6 @@ */ #endregion - using System; using System.Collections.Generic; using System.Text; @@ -54,14 +53,14 @@ namespace OpenTK.OpenGL /// public void Begin() { - GL.NewList(Id, Enums.ListMode.COMPILE); + GL.NewList(Id, GL.Enums.ListMode.COMPILE); } /// /// Starts recording elements into the display list. /// /// Sets if the list is to be compiled or compiled and executed immediately. - public void Begin(Enums.ListMode listMode) + public void Begin(GL.Enums.ListMode listMode) { GL.NewList(Id, listMode); } diff --git a/Source/OpenTK/OpenGL/GLHelper.cs b/Source/OpenTK/OpenGL/GLHelper.cs index 871a4e5b..e0983b8e 100644 --- a/Source/OpenTK/OpenGL/GLHelper.cs +++ b/Source/OpenTK/OpenGL/GLHelper.cs @@ -15,7 +15,7 @@ using System.Reflection; #endregion -//[assembly: CLSCompliant(true)] +[assembly: CLSCompliant(true)] namespace OpenTK.OpenGL { @@ -67,6 +67,12 @@ namespace OpenTK.OpenGL /// public static partial class GL { + #region internal string Library + + internal const string Library = "opengl32.dll"; + + #endregion + #region private enum Platform /// @@ -88,7 +94,7 @@ namespace OpenTK.OpenGL #region internal static extern IntPtr glxGetProcAddressARB(string s); // also linux, for our ARB-y friends - [DllImport(GL_NATIVE_LIBRARY, EntryPoint = "glXGetProcAddressARB")] + [DllImport(Library, EntryPoint = "glXGetProcAddressARB")] internal static extern IntPtr glxGetProcAddressARB(string s); #endregion @@ -247,7 +253,9 @@ Did you remember to copy OpenTK.OpenGL.dll.config to your binary's folder? { Delegate d; - if (Assembly.Load("OpenTK.OpenGL").GetType("OpenTK.OpenGL.Imports").GetMethod(name.Substring(2)) != null) + if (Assembly.GetExecutingAssembly() + .GetType("OpenTK.OpenGL.Imports") + .GetMethod(name.Substring(2), BindingFlags.NonPublic | BindingFlags.Static) != null) { d = GetDelegateForExtensionMethod(name, signature) ?? Delegate.CreateDelegate(signature, typeof(Imports), name.Substring(2)); @@ -302,14 +310,14 @@ Did you remember to copy OpenTK.OpenGL.dll.config to your binary's folder? } // Do not use cached results - string extension_string = GL.GetString(Enums.StringName.EXTENSIONS); + string extension_string = GL.GetString(GL.Enums.StringName.EXTENSIONS); if (String.IsNullOrEmpty(extension_string)) return false; // no extensions are available // Check if the user searches for GL_VERSION_X_X and search glGetString(GL_VERSION) instead. if (name.Contains("GL_VERSION_")) { - return GL.GetString(OpenTK.OpenGL.Enums.StringName.VERSION).Trim().StartsWith(name.Replace("GL_VERSION_", String.Empty).Replace('_', '.')); + return GL.GetString(OpenTK.OpenGL.GL.Enums.StringName.VERSION).Trim().StartsWith(name.Replace("GL_VERSION_", String.Empty).Replace('_', '.')); } // Search for the string given. @@ -334,7 +342,7 @@ Did you remember to copy OpenTK.OpenGL.dll.config to your binary's folder? AvailableExtensions = new Dictionary(); - string version_string = GL.GetString(OpenTK.OpenGL.Enums.StringName.VERSION); + string version_string = GL.GetString(OpenTK.OpenGL.GL.Enums.StringName.VERSION); if (String.IsNullOrEmpty(version_string)) return; // this shoudn't happen @@ -380,7 +388,7 @@ Did you remember to copy OpenTK.OpenGL.dll.config to your binary's folder? AvailableExtensions.Add("GL_VERSION_2_1", true); } - string extension_string = GL.GetString(OpenTK.OpenGL.Enums.StringName.EXTENSIONS); + string extension_string = GL.GetString(OpenTK.OpenGL.GL.Enums.StringName.EXTENSIONS); if (String.IsNullOrEmpty(extension_string)) return; // no extensions are available @@ -410,11 +418,11 @@ Did you remember to copy OpenTK.OpenGL.dll.config to your binary's folder? /// public static void ReloadFunctions() { - Assembly asm = Assembly.Load("OpenTK.OpenGL"); + Assembly asm = Assembly.GetExecutingAssembly();//Assembly.Load("OpenTK.OpenGL"); Type delegates_class = asm.GetType("OpenTK.OpenGL.Delegates"); Type imports_class = asm.GetType("OpenTK.OpenGL.Imports"); - FieldInfo[] v = delegates_class.GetFields(); + FieldInfo[] v = delegates_class.GetFields(BindingFlags.Static | BindingFlags.NonPublic); foreach (FieldInfo f in v) { f.SetValue(null, GetDelegateForMethod(f.Name, f.FieldType));