diff --git a/Source/OpenTK/Graphics/GL/GLHelper.cs b/Source/OpenTK/Graphics/GL/GLHelper.cs index 204e9eea..3e95f98e 100644 --- a/Source/OpenTK/Graphics/GL/GLHelper.cs +++ b/Source/OpenTK/Graphics/GL/GLHelper.cs @@ -335,39 +335,24 @@ namespace OpenTK.Graphics #endregion - #region static bool SupportsFunction(Type function) + #region static bool SupportsFunction(MethodInfo function) /// - /// Checks if a given OpenGL function is supported by the current context + /// Checks if a given OpenGL function is supported by the current context. /// - /// The System.Reflection.MethodInfo of the OpenGL function. - /// True if the function is supported, false otherwise - static bool SupportsFunction(MethodInfo method) + /// The System.Reflection.MethodInfo for the OpenGL function. + /// True if the function is supported, false otherwise. + static bool SupportsFunction(MethodInfo function) { - throw new NotImplementedException(); -#if false - lock (gl_lock) - { - - if (function == null) - throw new ArgumentNullException("function"); + if (function == null) + throw new ArgumentNullException("function"); - sb.Remove(0, sb.Length); - if (!function.Name.StartsWith("gl")) - sb.Append("gl"); - sb.Append(function); - //if (!function.EndsWith(extension)) - // sb.Append(extension); - - FieldInfo f = delegatesClass.GetField(sb.ToString(), BindingFlags.Static | BindingFlags.NonPublic); - if (f == null) - return false; - - return f.GetValue(null) != null; - + AutoGeneratedAttribute[] attr = (AutoGeneratedAttribute[]) + function.GetCustomAttributes(typeof(AutoGeneratedAttribute), false); + if (attr.Length == 0) return false; - } -#endif + + return SupportsFunction(attr[0].EntryPoint); } #endregion