OPENGL: Add notification function about context destruction.

This commit is contained in:
Johannes Schickel 2014-02-11 11:07:37 +01:00
parent 602d3034a9
commit 8be41e4f2c
2 changed files with 28 additions and 0 deletions

View file

@ -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

View file

@ -136,6 +136,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.
*/