void DirectFB_GL_Shutdown(_THIS) { if (!_this->gl_data || (--_this->gl_data->initialized > 0)) { return; } DirectFB_GL_UnloadLibrary(_this); SDL_free(_this->gl_data); _this->gl_data = NULL; }
int DirectFB_GL_LoadLibrary(_THIS, const char *path) { SDL_DFB_DEVICEDATA(_this); void *handle = NULL; SDL_DFB_DEBUG("Loadlibrary : %s\n", path); if (_this->gl_data->gl_active) { SDL_SetError("OpenGL context already created"); return -1; } if (path == NULL) { path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); if (path == NULL) { path = "libGL.so"; } } handle = GL_LoadObject(path); if (handle == NULL) { SDL_DFB_ERR("Library not found: %s\n", path); /* SDL_LoadObject() will call SDL_SetError() for us. */ return -1; } SDL_DFB_DEBUG("Loaded library: %s\n", path); /* Unload the old driver and reset the pointers */ DirectFB_GL_UnloadLibrary(_this); _this->gl_config.dll_handle = handle; _this->gl_config.driver_loaded = 1; if (path) { SDL_strlcpy(_this->gl_config.driver_path, path, SDL_arraysize(_this->gl_config.driver_path)); } else { *_this->gl_config.driver_path = '\0'; } devdata->glFinish = DirectFB_GL_GetProcAddress(_this, "glFinish"); devdata->glFlush = DirectFB_GL_GetProcAddress(_this, "glFlush"); return 0; }