Mercurial > sdl-ios-xcode
diff src/video/quartz/SDL_QuartzGL.m @ 1189:c96b326b90ba
Moved Quartz SDL_GL_LoadLibrary() to SDL_loadso interface.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Wed, 23 Nov 2005 07:23:48 +0000 |
parents | 49d3efec6651 |
children | bb6791b0a268 |
line wrap: on
line diff
--- a/src/video/quartz/SDL_QuartzGL.m Wed Nov 23 07:07:19 2005 +0000 +++ b/src/video/quartz/SDL_QuartzGL.m Wed Nov 23 07:23:48 2005 +0000 @@ -166,63 +166,33 @@ /* SDL OpenGL functions */ +static const char *DEFAULT_OPENGL_LIB_NAME = + "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"; int QZ_GL_LoadLibrary (_THIS, const char *location) { - CFURLRef bundleURL; - CFStringRef cfstr; - if ( gl_context != NULL ) { SDL_SetError("OpenGL context already created"); return -1; } - if (opengl_bundle != NULL) - CFRelease(opengl_bundle); - - opengl_bundle = NULL; - this->gl_config.driver_loaded = 0; + if (opengl_library != NULL) + SDL_UnloadObject(opengl_library); if (location == NULL) - location = "/System/Library/Frameworks/OpenGL.framework"; - - cfstr = CFStringCreateWithCString(kCFAllocatorDefault, location, - kCFStringEncodingUTF8); - if (cfstr == NULL) { - SDL_OutOfMemory(); - return -1; - } - - bundleURL = CFURLCreateWithFileSystemPath (kCFAllocatorDefault, - cfstr, kCFURLPOSIXPathStyle, true); + location = DEFAULT_OPENGL_LIB_NAME; - CFRelease(cfstr); - - if (bundleURL == NULL) { - SDL_OutOfMemory(); - return -1; - } - - opengl_bundle = CFBundleCreate (kCFAllocatorDefault, bundleURL); - - CFRelease(bundleURL); - - if (opengl_bundle != NULL) { + opengl_library = SDL_LoadObject(location); + if (opengl_library != NULL) { this->gl_config.driver_loaded = 1; return 0; } - /* not exactly descriptive, but okay... */ - SDL_SetError("Could not load OpenGL library"); + this->gl_config.driver_loaded = 0; return -1; } void* QZ_GL_GetProcAddress (_THIS, const char *proc) { - CFStringRef funcName = CFStringCreateWithCString - (kCFAllocatorDefault, proc, kCFStringEncodingASCII); - - void *func = CFBundleGetFunctionPointerForName(opengl_bundle, funcName); - CFRelease (funcName); - return func; + return SDL_LoadFunction(opengl_library, proc); } int QZ_GL_GetAttribute (_THIS, SDL_GLattr attrib, int* value) {