diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 20 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.h | 8 |
2 files changed, 28 insertions, 0 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index a97f680f15..3b92acc505 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -881,6 +881,26 @@ void OpenGLGraphicsManager::notifyContextChange(const Graphics::PixelFormat &def #endif } +void OpenGLGraphicsManager::notifyContextDestroy() { + if (_gameScreen) { + _gameScreen->releaseInternalTexture(); + } + + if (_overlay) { + _overlay->releaseInternalTexture(); + } + + if (_cursor) { + _cursor->releaseInternalTexture(); + } + +#ifdef USE_OSD + if (_osd) { + _osd->releaseInternalTexture(); + } +#endif +} + void OpenGLGraphicsManager::adjustMousePosition(int16 &x, int16 &y) { if (_overlayVisible) { // It might be confusing that we actually have to handle something diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index 93c0c5bc83..8d53dbe062 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -137,6 +137,14 @@ protected: void notifyContextChange(const Graphics::PixelFormat &defaultFormat, const Graphics::PixelFormat &defaultFormatAlpha); /** + * Notify the manager that the OpenGL context is about to be destroyed. + * This will free up/reset internal OpenGL related state and *must* be + * called whenever a context might be created again after destroying a + * context. + */ + void notifyContextDestroy(); + + /** * Adjust the physical mouse coordinates according to the currently visible screen. */ void adjustMousePosition(int16 &x, int16 &y); |