3 * Copyright (c) 2001 César Blecua Udías All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * CESAR BLECUA UDIAS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
20 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 #include "extensions.hxx"
29 static bool SGSearchExtensionsString(char *extString, char *extName) {
30 // Returns GL_TRUE if the *extName string appears in the *extString string,
31 // surrounded by white spaces, or GL_FALSE otherwise.
36 if ((extString == NULL) || (extName == NULL))
39 extNameLen = strlen(extName);
46 if ((extNameLen == n) && (strncmp(extName, p, n) == 0))
55 bool SGIsOpenGLExtensionSupported(char *extName) {
56 // Returns GL_TRUE if the OpenGL Extension whose name is *extName
57 // is supported by the system, or GL_FALSE otherwise.
59 // The *extName string must follow the OpenGL extensions naming scheme
60 // (ie: "GL_type_extension", like GL_EXT_convolution)
62 return SGSearchExtensionsString((char *)glGetString(GL_EXTENSIONS),
68 #include <CoreFoundation/CoreFoundation.h>
70 void* macosxGetGLProcAddress(const char *func) {
72 /* We may want to cache the bundleRef at some point */
73 static CFBundleRef bundle = 0;
77 CFURLRef bundleURL = CFURLCreateWithFileSystemPath (kCFAllocatorDefault,
78 CFSTR("/System/Library/Frameworks/OpenGL.framework"), kCFURLPOSIXPathStyle, true);
80 bundle = CFBundleCreate (kCFAllocatorDefault, bundleURL);
81 CFRelease (bundleURL);
87 CFStringRef functionName = CFStringCreateWithCString
88 (kCFAllocatorDefault, func, kCFStringEncodingASCII);
92 function = CFBundleGetFunctionPointerForName (bundle, functionName);
94 CFRelease (functionName);