[Scummvm-cvs-logs] SF.net SVN: scummvm:[51675] scummvm/branches/gsoc2010-opengl/backends/ graphics/opengl
vgvgf at users.sourceforge.net
vgvgf at users.sourceforge.net
Tue Aug 3 04:30:36 CEST 2010
Revision: 51675
http://scummvm.svn.sourceforge.net/scummvm/?rev=51675&view=rev
Author: vgvgf
Date: 2010-08-03 02:30:36 +0000 (Tue, 03 Aug 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h
scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp 2010-08-03 02:10:55 UTC (rev 51674)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp 2010-08-03 02:30:36 UTC (rev 51675)
@@ -230,7 +230,6 @@
_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 @@
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 @@
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 @@
#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
}
Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h 2010-08-03 02:10:55 UTC (rev 51674)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h 2010-08-03 02:30:36 UTC (rev 51675)
@@ -136,7 +136,6 @@
bool sizeChanged;
bool needHotswap;
bool needUpdatescreen;
- bool newContext;
bool filterChanged;
#ifdef USE_RGB_COLOR
bool formatChanged;
Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp 2010-08-03 02:10:55 UTC (rev 51674)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp 2010-08-03 02:30:36 UTC (rev 51675)
@@ -357,11 +357,6 @@
// Failed setuping a fullscreen mode
return false;
- // If changing to any fullscreen mode or from fullscreen,
- // the OpenGL context is destroyed
- if (_oldVideoMode.fullscreen || _videoMode.fullscreen)
- _transactionDetails.newContext = true;
-
// Create our window
_hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 32,
_videoMode.fullscreen ? (SDL_FULLSCREEN | SDL_OPENGL) : (SDL_OPENGL | SDL_RESIZABLE)
@@ -586,10 +581,6 @@
_videoMode.hardwareHeight = event.mouse.y;
_screenResized = true;
_transactionDetails.sizeChanged = true;
- // The OpenGL context is not always destroyed during resizing,
- // however it is better to waste some time recreating it than
- // getting a blank screen
- _transactionDetails.newContext = true;
endGFXTransaction();
return true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list