aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl
diff options
context:
space:
mode:
authorJohannes Schickel2011-03-20 17:29:08 +0100
committerJohannes Schickel2011-03-20 17:29:08 +0100
commit6502e191b939ad836c92dc602a6f0e4e4c75b044 (patch)
treed4878261f9aab946bc0fa8b9316f4ac3f7d33cf1 /backends/graphics/opengl
parent89f9c5a9c35834856bb3692fb30a9eb42606ec91 (diff)
downloadscummvm-rg350-6502e191b939ad836c92dc602a6f0e4e4c75b044.tar.gz
scummvm-rg350-6502e191b939ad836c92dc602a6f0e4e4c75b044.tar.bz2
scummvm-rg350-6502e191b939ad836c92dc602a6f0e4e4c75b044.zip
OPENGL: Handle aspect ratio correction as flag instead of having a special mode for it.
This partly fixes the OpenGL mode mess, but now OpenGL Normal and OpenGL Conserve will feature the same semantics when aspect ratio correction is enabled... That is still something to solve.
Diffstat (limited to 'backends/graphics/opengl')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp26
-rw-r--r--backends/graphics/opengl/opengl-graphics.h4
2 files changed, 13 insertions, 17 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index fd8c2ccffe..6904a1d094 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -103,14 +103,8 @@ void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
break;
case OSystem::kFeatureAspectRatioCorrection:
- // TODO: If we enable aspect ratio correction, we automatically set
- // the video mode to 4/3. That is quity messy, but since we have that
- // messy OpenGL mode use there's not much to do about it right now...
- // Of course in case we disasble the aspect ratio correction, we
- // might want to setup a different mode, but which one?
- // Think of a way to get rid of this mess.
- if (enable)
- _videoMode.mode = OpenGL::GFX_4_3;
+ _videoMode.aspectRatioCorrection = enable;
+ _transactionDetails.needRefresh = true;
break;
default:
@@ -124,7 +118,7 @@ bool OpenGLGraphicsManager::getFeatureState(OSystem::Feature f) {
return _videoMode.fullscreen;
case OSystem::kFeatureAspectRatioCorrection:
- return _videoMode.mode == OpenGL::GFX_4_3;
+ return _videoMode.aspectRatioCorrection;
default:
return false;
@@ -138,7 +132,6 @@ bool OpenGLGraphicsManager::getFeatureState(OSystem::Feature f) {
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
{"gl1", _s("OpenGL Normal"), OpenGL::GFX_NORMAL},
{"gl2", _s("OpenGL Conserve"), OpenGL::GFX_CONSERVE},
- {"gl3", _s("OpenGL 4/3"), OpenGL::GFX_4_3},
{"gl4", _s("OpenGL Original"), OpenGL::GFX_ORIGINAL},
{0, 0, 0}
};
@@ -166,11 +159,10 @@ bool OpenGLGraphicsManager::setGraphicsMode(int mode) {
switch (mode) {
case OpenGL::GFX_NORMAL:
case OpenGL::GFX_CONSERVE:
- case OpenGL::GFX_4_3:
case OpenGL::GFX_ORIGINAL:
break;
default:
- warning("unknown gfx mode %d", mode);
+ warning("Unknown gfx mode %d", mode);
return false;
}
@@ -1262,10 +1254,14 @@ void OpenGLGraphicsManager::toggleAntialiasing() {
}
uint OpenGLGraphicsManager::getAspectRatio() {
- if (_videoMode.mode == OpenGL::GFX_NORMAL)
- return _videoMode.hardwareWidth * 10000 / _videoMode.hardwareHeight;
- else if (_videoMode.mode == OpenGL::GFX_4_3)
+ // In case we enable aspect ratio correction we force a 4/3 ratio.
+ // TODO: This makes OpenGL Normal behave like OpenGL Conserve, when aspect
+ // ratio correction is enabled, but it's better than the previous 4/3 mode
+ // mess at least...
+ if (_videoMode.aspectRatioCorrection)
return 13333;
+ else if (_videoMode.mode == OpenGL::GFX_NORMAL)
+ return _videoMode.hardwareWidth * 10000 / _videoMode.hardwareHeight;
else
return _videoMode.screenWidth * 10000 / _videoMode.screenHeight;
}
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index f674015b4a..33eab7653c 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -39,8 +39,7 @@ namespace OpenGL {
enum {
GFX_NORMAL = 0,
GFX_CONSERVE = 1,
- GFX_4_3 = 2,
- GFX_ORIGINAL = 3
+ GFX_ORIGINAL = 2
};
}
@@ -156,6 +155,7 @@ protected:
int mode;
int scaleFactor;
bool antialiasing;
+ bool aspectRatioCorrection;
int screenWidth, screenHeight;
int overlayWidth, overlayHeight;