aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorJohannes Schickel2014-02-11 11:07:37 +0100
committerJohannes Schickel2014-02-11 11:10:48 +0100
commit8be41e4f2ce353a97a2d41bee78cc99ca12b619a (patch)
tree2f1df1a9175bcb249089c60d8f6c4e720ef58121 /backends
parent602d3034a97517ecdaabde14a8b4928ddb3b9303 (diff)
downloadscummvm-rg350-8be41e4f2ce353a97a2d41bee78cc99ca12b619a.tar.gz
scummvm-rg350-8be41e4f2ce353a97a2d41bee78cc99ca12b619a.tar.bz2
scummvm-rg350-8be41e4f2ce353a97a2d41bee78cc99ca12b619a.zip
OPENGL: Add notification function about context destruction.
Diffstat (limited to 'backends')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp20
-rw-r--r--backends/graphics/opengl/opengl-graphics.h8
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);