aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Marzini2010-07-13 05:38:10 +0000
committerAlejandro Marzini2010-07-13 05:38:10 +0000
commit84ceae932852fe684ea553daee712b52da83add6 (patch)
tree13bc020842cff6ebc0d12685551c122ec3df4f12
parent5f86d1127528244f20296833889881e185f16795 (diff)
downloadscummvm-rg350-84ceae932852fe684ea553daee712b52da83add6.tar.gz
scummvm-rg350-84ceae932852fe684ea553daee712b52da83add6.tar.bz2
scummvm-rg350-84ceae932852fe684ea553daee712b52da83add6.zip
Check if USE_OPENGL is defined for compiling OpenGL code.
svn-id: r50842
-rw-r--r--backends/graphics/opengl/glerrorcheck.cpp2
-rw-r--r--backends/graphics/opengl/gltexture.cpp4
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp17
-rw-r--r--backends/graphics/opengl/opengl-graphics.h8
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp4
-rw-r--r--backends/platform/sdl/sdl.cpp30
6 files changed, 55 insertions, 10 deletions
diff --git a/backends/graphics/opengl/glerrorcheck.cpp b/backends/graphics/opengl/glerrorcheck.cpp
index b93012b965..b64c8330f5 100644
--- a/backends/graphics/opengl/glerrorcheck.cpp
+++ b/backends/graphics/opengl/glerrorcheck.cpp
@@ -23,7 +23,7 @@
*
*/
-#if defined(DEBUG) //&& defined(USE_OPENGL)
+#if defined(DEBUG) && defined(USE_OPENGL)
#include "backends/graphics/opengl/glerrorcheck.h"
#include "common/debug.h"
diff --git a/backends/graphics/opengl/gltexture.cpp b/backends/graphics/opengl/gltexture.cpp
index 139222bc36..0a3e607d42 100644
--- a/backends/graphics/opengl/gltexture.cpp
+++ b/backends/graphics/opengl/gltexture.cpp
@@ -23,6 +23,8 @@
*
*/
+#ifdef USE_OPENGL
+
#include "backends/graphics/opengl/gltexture.h"
#include "backends/graphics/opengl/glerrorcheck.h"
@@ -175,3 +177,5 @@ void GLTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
assert(ARRAYSIZE(vertices) == ARRAYSIZE(texcoords));
CHECK_GL_ERROR( glDrawArrays(GL_TRIANGLE_STRIP, 0, ARRAYSIZE(vertices) / 2) );
}
+
+#endif
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index fc864957d8..f5f0cdeb57 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -23,8 +23,11 @@
*
*/
+#ifdef USE_OPENGL
+
#include "backends/graphics/opengl/opengl-graphics.h"
#include "common/mutex.h"
+#include "common/translation.h"
OpenGLGraphicsManager::OpenGLGraphicsManager()
:
@@ -41,7 +44,7 @@ OpenGLGraphicsManager::OpenGLGraphicsManager()
memset(&_videoMode, 0, sizeof(_videoMode));
memset(&_transactionDetails, 0, sizeof(_transactionDetails));
- _videoMode.mode = GFX_NORMAL;
+ _videoMode.mode = OpenGL::GFX_NORMAL;
_videoMode.scaleFactor = 1;
_videoMode.fullscreen = false;
}
@@ -91,7 +94,11 @@ bool OpenGLGraphicsManager::getFeatureState(OSystem::Feature f) {
//
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
- {"1x", "Normal", GFX_NORMAL},
+ {"gl1x", _s("OpenGL Normal (no scaling)"), OpenGL::GFX_NORMAL},
+#ifdef USE_SCALERS
+ {"gl2x", "OpenGL 2x", OpenGL::GFX_DOUBLESIZE},
+ {"gl3x", "OpenGL 3x", OpenGL::GFX_TRIPLESIZE},
+#endif
{0, 0, 0}
};
@@ -100,7 +107,7 @@ const OSystem::GraphicsMode *OpenGLGraphicsManager::getSupportedGraphicsModes()
}
int OpenGLGraphicsManager::getDefaultGraphicsMode() const {
- return GFX_NORMAL;
+ return OpenGL::GFX_NORMAL;
}
bool OpenGLGraphicsManager::setGraphicsMode(int mode) {
@@ -108,7 +115,7 @@ bool OpenGLGraphicsManager::setGraphicsMode(int mode) {
}
int OpenGLGraphicsManager::getGraphicsMode() const {
- return GFX_NORMAL;
+ return OpenGL::GFX_NORMAL;
}
#ifdef USE_RGB_COLOR
@@ -496,3 +503,5 @@ void OpenGLGraphicsManager::unloadGFXMode() {
bool OpenGLGraphicsManager::hotswapGFXMode() {
return false;
}
+
+#endif
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index 17d0b842e9..e0807d8a73 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -29,10 +29,16 @@
#include "backends/graphics/opengl/gltexture.h"
#include "backends/graphics/graphics.h"
+namespace OpenGL {
+
enum {
- GFX_NORMAL = 0
+ GFX_NORMAL = 0,
+ GFX_DOUBLESIZE = 1,
+ GFX_TRIPLESIZE = 2
};
+}
+
/**
* Open GL graphics manager
*/
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index b12c3af5cd..1b9ef6d663 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -23,6 +23,8 @@
*
*/
+#ifdef USE_OPENGL
+
#include "backends/graphics/openglsdl/openglsdl-graphics.h"
OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager()
@@ -186,3 +188,5 @@ bool OpenGLSdlGraphicsManager::hotswapGFXMode() {
void OpenGLSdlGraphicsManager::internUpdateScreen() {
}
+
+#endif
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index e5ae3bb523..58e4167a7c 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -32,8 +32,10 @@
#include "backends/events/sdl/sdl-events.h"
#include "backends/mutex/sdl/sdl-mutex.h"
#include "backends/timer/sdl/sdl-timer.h"
-//#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/sdl/sdl-graphics.h"
+#ifdef USE_OPENGL
#include "backends/graphics/openglsdl/openglsdl-graphics.h"
+#endif
#include "icons/scummvm.xpm"
@@ -84,11 +86,31 @@ void OSystem_SDL::initBackend() {
}
if (_graphicsManager == 0) {
- // Changed to OpenGL for testing
- //_graphicsManager = new SdlGraphicsManager();
- _graphicsManager = new OpenGLSdlGraphicsManager();
+#ifdef USE_OPENGL
+ /*if (ConfMan.hasKey("gfx_mode")) {
+ Common::String gfxMode(ConfMan.get("gfx_mode"));
+
+ _openglGraphicsMode = OpenGLSdlGraphicsManager::getSupportedGraphicsModes();
+
+ bool use_opengl = false;
+ while (_openglGraphicsMode->name) {
+ if (scumm_stricmp(_openglGraphicsMode->name, gfxMode.c_str()) == 0)
+ use_opengl = true;
+
+ _openglGraphicsMode++;
+ }
+
+ if (use_opengl) {
+ _graphicsManager = new OpenGLSdlGraphicsManager();
+ ((OpenGLSdlGraphicsManager *)_graphicsManager)->init();
+ }
+ }*/
+ _graphicsManager = new OpenGLSdlGraphicsManager();
((OpenGLSdlGraphicsManager *)_graphicsManager)->init();
+#endif
+ if (_graphicsManager == 0)
+ _graphicsManager = new SdlGraphicsManager();
}
if (_audiocdManager == 0)