src/video/cocoa/SDL_cocoaopengl.m
changeset 3057 089a77aebb7d
parent 2859 99210400e8b9
child 3570 7812d3e9564e
     1.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Sun Feb 08 15:35:06 2009 +0000
     1.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Mon Feb 09 05:32:12 2009 +0000
     1.3 @@ -48,15 +48,7 @@
     1.4  int
     1.5  Cocoa_GL_LoadLibrary(_THIS, const char *path)
     1.6  {
     1.7 -    if (_this->gl_config.driver_loaded) {
     1.8 -        if (path) {
     1.9 -            SDL_SetError("OpenGL library already loaded");
    1.10 -            return -1;
    1.11 -        } else {
    1.12 -            ++_this->gl_config.driver_loaded;
    1.13 -            return 0;
    1.14 -        }
    1.15 -    }
    1.16 +    /* Load the OpenGL library */
    1.17      if (path == NULL) {
    1.18          path = SDL_getenv("SDL_OPENGL_LIBRARY");
    1.19      }
    1.20 @@ -69,7 +61,6 @@
    1.21      }
    1.22      SDL_strlcpy(_this->gl_config.driver_path, path,
    1.23                  SDL_arraysize(_this->gl_config.driver_path));
    1.24 -    _this->gl_config.driver_loaded = 1;
    1.25      return 0;
    1.26  }
    1.27  
    1.28 @@ -79,68 +70,11 @@
    1.29      return SDL_LoadFunction(_this->gl_config.dll_handle, proc);
    1.30  }
    1.31  
    1.32 -static void
    1.33 +void
    1.34  Cocoa_GL_UnloadLibrary(_THIS)
    1.35  {
    1.36 -    if (_this->gl_config.driver_loaded > 0) {
    1.37 -        if (--_this->gl_config.driver_loaded > 0) {
    1.38 -            return;
    1.39 -        }
    1.40 -        SDL_UnloadObject(_this->gl_config.dll_handle);
    1.41 -        _this->gl_config.dll_handle = NULL;
    1.42 -    }
    1.43 -}
    1.44 -
    1.45 -static int
    1.46 -Cocoa_GL_Initialize(_THIS)
    1.47 -{
    1.48 -    if (_this->gl_data) {
    1.49 -        ++_this->gl_data->initialized;
    1.50 -        return 0;
    1.51 -    }
    1.52 -
    1.53 -    _this->gl_data =
    1.54 -        (struct SDL_GLDriverData *) SDL_calloc(1,
    1.55 -                                               sizeof(struct
    1.56 -                                                      SDL_GLDriverData));
    1.57 -    if (!_this->gl_data) {
    1.58 -        SDL_OutOfMemory();
    1.59 -        return -1;
    1.60 -    }
    1.61 -    _this->gl_data->initialized = 1;
    1.62 -
    1.63 -    if (Cocoa_GL_LoadLibrary(_this, NULL) < 0) {
    1.64 -        return -1;
    1.65 -    }
    1.66 -    return 0;
    1.67 -}
    1.68 -
    1.69 -static void
    1.70 -Cocoa_GL_Shutdown(_THIS)
    1.71 -{
    1.72 -    if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
    1.73 -        return;
    1.74 -    }
    1.75 -
    1.76 -    Cocoa_GL_UnloadLibrary(_this);
    1.77 -
    1.78 -    SDL_free(_this->gl_data);
    1.79 -    _this->gl_data = NULL;
    1.80 -}
    1.81 -
    1.82 -int
    1.83 -Cocoa_GL_SetupWindow(_THIS, SDL_Window * window)
    1.84 -{
    1.85 -    if (Cocoa_GL_Initialize(_this) < 0) {
    1.86 -        return -1;
    1.87 -    }
    1.88 -    return 0;
    1.89 -}
    1.90 -
    1.91 -void
    1.92 -Cocoa_GL_CleanupWindow(_THIS, SDL_Window * window)
    1.93 -{
    1.94 -    Cocoa_GL_Shutdown(_this);
    1.95 +    SDL_UnloadObject(_this->gl_config.dll_handle);
    1.96 +    _this->gl_config.dll_handle = NULL;
    1.97  }
    1.98  
    1.99  SDL_GLContext