Check if USE_OPENGL is defined for compiling OpenGL code.

svn-id: r50842
This commit is contained in:
Alejandro Marzini 2010-07-13 05:38:10 +00:00
parent 5f86d11275
commit 84ceae9328
6 changed files with 55 additions and 10 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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