Index: /mnt/mfhome/andre/mame/SDL13/src/video/x11/SDL_x11opengl.c =================================================================== --- /mnt/mfhome/andre/mame/SDL13/src/video/x11/SDL_x11opengl.c (revision 3681) +++ /mnt/mfhome/andre/mame/SDL13/src/video/x11/SDL_x11opengl.c (working copy) @@ -73,23 +73,28 @@ void *handle; if (_this->gl_config.driver_loaded) { + // do not return without reinitializing the function hooks if (path) { SDL_SetError("OpenGL library already loaded"); - return -1; - } else { - ++_this->gl_config.driver_loaded; - return 0; + // return -1; } + handle = _this->gl_config.dll_handle; } - if (path == NULL) { - path = SDL_getenv("SDL_OPENGL_LIBRARY"); - } - if (path == NULL) { - path = DEFAULT_OPENGL; - } - handle = GL_LoadObject(path); - if (!handle) { - return -1; + else + { + if (path == NULL) { + path = SDL_getenv("SDL_OPENGL_LIBRARY"); + } + if (path == NULL) { + path = DEFAULT_OPENGL; + } + handle = GL_LoadObject(path); + if (!handle) { + return -1; + } + _this->gl_config.dll_handle = handle; + SDL_strlcpy(_this->gl_config.driver_path, path, + SDL_arraysize(_this->gl_config.driver_path)); } // LoadLibrary may be called before WindowCreate! // Must create the memory used by GL @@ -123,10 +128,7 @@ return -1; } - _this->gl_config.dll_handle = handle; - SDL_strlcpy(_this->gl_config.driver_path, path, - SDL_arraysize(_this->gl_config.driver_path)); - _this->gl_config.driver_loaded = 1; + _this->gl_config.driver_loaded++; return 0; }