diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 653220866..133332f8b 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -5930,6 +5930,7 @@ void HWR_Shutdown(void) HWR_FreeExtraSubsectors(); HWR_FreeMapTextures(); GL_FlushScreenTextures(); + HWR_ClearAllTextures(); #ifdef USE_FBO_OGL GL_Framebuffer_Disable(); #endif diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 4fbf42bc3..acf4f754e 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -2180,12 +2180,24 @@ void I_ShutdownGraphics(void) I_OutputMsg("shut down\n"); #ifdef HWRENDER + if (vid.glstate == VID_GL_LIBRARY_LOADED) + HWR_Shutdown(); + if (sdlglcontext) - { SDL_GL_DeleteContext(sdlglcontext); - } + sdlglcontext = NULL; #endif + if (texture) + SDL_DestroyTexture(texture); + texture = NULL; + if (renderer) + SDL_DestroyRenderer(renderer); + renderer = NULL; + if (window) + SDL_DestroyWindow(window); + window = NULL; + SDL_QuitSubSystem(SDL_INIT_VIDEO); framebuffer = SDL_FALSE; } diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index e029b3316..b63166639 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -81,7 +81,7 @@ boolean UseScreenFBO(void) /** \brief SDL video display surface */ INT32 oglflags = 0; -SDL_GLContext sdlglcontext = 0; +SDL_GLContext sdlglcontext = NULL; void *GetGLFunc(const char *proc) {