src/video/quartz/SDL_QuartzGL.m
changeset 1189 c96b326b90ba
parent 1181 49d3efec6651
child 1195 bb6791b0a268
     1.1 --- a/src/video/quartz/SDL_QuartzGL.m	Wed Nov 23 07:07:19 2005 +0000
     1.2 +++ b/src/video/quartz/SDL_QuartzGL.m	Wed Nov 23 07:23:48 2005 +0000
     1.3 @@ -166,63 +166,33 @@
     1.4  
     1.5  
     1.6  /* SDL OpenGL functions */
     1.7 +static const char *DEFAULT_OPENGL_LIB_NAME =
     1.8 +    "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib";
     1.9  
    1.10  int    QZ_GL_LoadLibrary    (_THIS, const char *location) {
    1.11 -    CFURLRef bundleURL;
    1.12 -    CFStringRef cfstr;
    1.13 -
    1.14      if ( gl_context != NULL ) {
    1.15          SDL_SetError("OpenGL context already created");
    1.16          return -1;
    1.17      }
    1.18  
    1.19 -    if (opengl_bundle != NULL)
    1.20 -        CFRelease(opengl_bundle);
    1.21 -
    1.22 -    opengl_bundle = NULL;
    1.23 -    this->gl_config.driver_loaded = 0;
    1.24 +    if (opengl_library != NULL)
    1.25 +        SDL_UnloadObject(opengl_library);
    1.26  
    1.27      if (location == NULL)
    1.28 -        location = "/System/Library/Frameworks/OpenGL.framework";
    1.29 -
    1.30 -    cfstr = CFStringCreateWithCString(kCFAllocatorDefault, location,
    1.31 -                                      kCFStringEncodingUTF8);
    1.32 -    if (cfstr == NULL) {
    1.33 -        SDL_OutOfMemory();
    1.34 -        return -1;
    1.35 -    }
    1.36 -
    1.37 -    bundleURL = CFURLCreateWithFileSystemPath (kCFAllocatorDefault,
    1.38 -                        cfstr, kCFURLPOSIXPathStyle, true);
    1.39 +        location = DEFAULT_OPENGL_LIB_NAME;
    1.40  
    1.41 -    CFRelease(cfstr);
    1.42 -
    1.43 -    if (bundleURL == NULL) {
    1.44 -        SDL_OutOfMemory();
    1.45 -        return -1;
    1.46 -    }
    1.47 -
    1.48 -    opengl_bundle = CFBundleCreate (kCFAllocatorDefault, bundleURL);
    1.49 -
    1.50 -    CFRelease(bundleURL);
    1.51 -
    1.52 -    if (opengl_bundle != NULL) {
    1.53 +    opengl_library = SDL_LoadObject(location);
    1.54 +    if (opengl_library != NULL) {
    1.55          this->gl_config.driver_loaded = 1;
    1.56          return 0;
    1.57      }
    1.58  
    1.59 -    /* not exactly descriptive, but okay... */
    1.60 -    SDL_SetError("Could not load OpenGL library");
    1.61 +    this->gl_config.driver_loaded = 0;
    1.62      return -1;
    1.63  }
    1.64  
    1.65  void*  QZ_GL_GetProcAddress (_THIS, const char *proc) {
    1.66 -    CFStringRef funcName = CFStringCreateWithCString
    1.67 -        (kCFAllocatorDefault, proc, kCFStringEncodingASCII);
    1.68 -
    1.69 -    void *func = CFBundleGetFunctionPointerForName(opengl_bundle, funcName);
    1.70 -    CFRelease (funcName);
    1.71 -    return func;
    1.72 +    return SDL_LoadFunction(opengl_library, proc);
    1.73  }
    1.74  
    1.75  int    QZ_GL_GetAttribute   (_THIS, SDL_GLattr attrib, int* value) {