aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl/opengl-graphics.cpp
diff options
context:
space:
mode:
authorAlejandro Marzini2010-08-03 02:30:36 +0000
committerAlejandro Marzini2010-08-03 02:30:36 +0000
commit498c17655dbc448ed8bdd8146b0ca1dd0dfc9463 (patch)
treea1c4e2699fe8aed5e410e42e16580ec9ce3485fb /backends/graphics/opengl/opengl-graphics.cpp
parent5439b173b3df4580f9a3ea50b145779024dd5543 (diff)
downloadscummvm-rg350-498c17655dbc448ed8bdd8146b0ca1dd0dfc9463.tar.gz
scummvm-rg350-498c17655dbc448ed8bdd8146b0ca1dd0dfc9463.tar.bz2
scummvm-rg350-498c17655dbc448ed8bdd8146b0ca1dd0dfc9463.zip
OPENGL: Refresh OpenGL textures on all loadGFX() calls.
OpenGL context may be destroyed after calling SDL_SetVideoMode, so it is better to always recreate the textures. svn-id: r51675
Diffstat (limited to 'backends/graphics/opengl/opengl-graphics.cpp')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index dfb020c256..ddace8f3a4 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -230,7 +230,6 @@ void OpenGLGraphicsManager::beginGFXTransaction() {
_transactionDetails.sizeChanged = false;
_transactionDetails.needHotswap = false;
_transactionDetails.needUpdatescreen = false;
- _transactionDetails.newContext = false;
_transactionDetails.filterChanged = false;
#ifdef USE_RGB_COLOR
_transactionDetails.formatChanged = false;
@@ -1075,7 +1074,8 @@ void OpenGLGraphicsManager::loadTextures() {
getGLPixelFormat(Graphics::PixelFormat::createFormatCLUT8(), bpp, intformat, format, type);
#endif
_gameTexture = new GLTexture(bpp, intformat, format, type);
- }
+ } else
+ _gameTexture->refresh();
_overlayFormat = Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0);
@@ -1086,24 +1086,19 @@ void OpenGLGraphicsManager::loadTextures() {
GLenum type;
getGLPixelFormat(_overlayFormat, bpp, intformat, format, type);
_overlayTexture = new GLTexture(bpp, intformat, format, type);
- }
+ } else
+ _overlayTexture->refresh();
if (!_cursorTexture)
_cursorTexture = new GLTexture(4, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE);
+ else
+ _cursorTexture->refresh();
GLint filter = _videoMode.antialiasing ? GL_LINEAR : GL_NEAREST;
_gameTexture->setFilter(filter);
_overlayTexture->setFilter(filter);
_cursorTexture->setFilter(filter);
- if (_transactionDetails.newContext || _transactionDetails.filterChanged) {
- // If the context was destroyed or it is needed to change the texture filter
- // we need to recreate the textures
- _gameTexture->refresh();
- _overlayTexture->refresh();
- _cursorTexture->refresh();
- }
-
// Allocate texture memory and finish refreshing
_gameTexture->allocBuffer(_videoMode.screenWidth, _videoMode.screenHeight);
_overlayTexture->allocBuffer(_videoMode.overlayWidth, _videoMode.overlayHeight);
@@ -1127,9 +1122,9 @@ void OpenGLGraphicsManager::loadTextures() {
#ifdef USE_OSD
if (!_osdTexture)
_osdTexture = new GLTexture(2, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
-
- if (_transactionDetails.newContext || _transactionDetails.filterChanged)
+ else
_osdTexture->refresh();
+
_osdTexture->allocBuffer(_videoMode.overlayWidth, _videoMode.overlayHeight);
#endif
}