/// <summary> /// /// </summary> /// <param name="s"></param> /// <returns></returns> public static IntPtr GetProcAddress(string s) { if (gpaPlatform == GetProcAddressPlatform.Unknown) { IntPtr result = IntPtr.Zero; // WGL? try { result = wglGetProcAddress(s); gpaPlatform = GetProcAddressPlatform.Windows; return(result); } catch (Exception) { } // AGL? (before X11, since GLX might exist on OSX) try { result = aglGetProcAddress(s); gpaPlatform = GetProcAddressPlatform.OSX; return(result); } catch (Exception) { } // X11? try { result = glxGetProcAddress(s); gpaPlatform = GetProcAddressPlatform.X11; return(result); } catch (Exception) { } // X11 ARB? try { result = glxGetProcAddressARB(s); gpaPlatform = GetProcAddressPlatform.X11_ARB; return(result); } catch (Exception) { } // Ack! throw new NotSupportedException("Can't figure out how to call GetProcAddress on this platform!"); } else if (gpaPlatform == GetProcAddressPlatform.Windows) { return(wglGetProcAddress(s)); } else if (gpaPlatform == GetProcAddressPlatform.OSX) { return(aglGetProcAddress(s)); } else if (gpaPlatform == GetProcAddressPlatform.X11) { return(glxGetProcAddress(s)); } else if (gpaPlatform == GetProcAddressPlatform.X11_ARB) { return(glxGetProcAddressARB(s)); } throw new NotSupportedException("Shouldn't get here.."); }
/// <summary> /// /// </summary> /// <param name="s"></param> /// <returns></returns> public static IntPtr GetProcAddress(string s) { if (gpaPlatform == GetProcAddressPlatform.Unknown) { IntPtr result = IntPtr.Zero; // WGL? try { result = wglGetProcAddress(s); gpaPlatform = GetProcAddressPlatform.Windows; return result; } catch (Exception) { } // AGL? (before X11, since GLX might exist on OSX) try { result = aglGetProcAddress(s); gpaPlatform = GetProcAddressPlatform.OSX; return result; } catch (Exception) { } // X11? try { result = glxGetProcAddress(s); gpaPlatform = GetProcAddressPlatform.X11; return result; } catch (Exception) { } // X11 ARB? try { result = glxGetProcAddressARB(s); gpaPlatform = GetProcAddressPlatform.X11_ARB; return result; } catch (Exception) { } // Ack! throw new NotSupportedException("Can't figure out how to call GetProcAddress on this platform!"); } else if (gpaPlatform == GetProcAddressPlatform.Windows) { return wglGetProcAddress(s); } else if (gpaPlatform == GetProcAddressPlatform.OSX) { return aglGetProcAddress(s); } else if (gpaPlatform == GetProcAddressPlatform.X11) { return glxGetProcAddress(s); } else if (gpaPlatform == GetProcAddressPlatform.X11_ARB) { return glxGetProcAddressARB(s); } throw new NotSupportedException("Shouldn't get here.."); }