From 75a80fdfdce4be53ce7d7b1d02400d3f79a144c0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 26 Oct 2012 13:33:20 +0300 Subject: Android compilation fixes. --- src/commandhandler.cpp | 2 +- src/graphicsmanager.cpp | 6 ++++++ src/gui/setup_video.cpp | 15 ++++++++++----- src/normalopenglgraphics.cpp | 3 +-- src/normalopenglgraphics.h | 2 +- src/resources/openglimagehelper.cpp | 7 +++++++ src/safeopenglgraphics.cpp | 2 +- src/safeopenglgraphics.h | 2 +- 8 files changed, 28 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index c17234c18..001c50e6b 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -1396,7 +1396,7 @@ void CommandHandler::replaceVars(std::string &str) void CommandHandler::handleDumpOGL(const std::string &args A_UNUSED, ChatTab *const tab A_UNUSED) { -#if defined USE_OPENGL +#if defined USE_OPENGL && !defined ANDROID NormalOpenGLGraphics::dumpSettings(); #endif } diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 4c97ea327..4ffe48042 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -208,6 +208,7 @@ void GraphicsManager::initGraphics(bool noOpenGL) break; case 1: default: +#ifndef ANDROID imageHelper = new OpenGLImageHelper; sdlImageHelper = new SDLImageHelper; mainGraphics = new NormalOpenGLGraphics; @@ -219,6 +220,7 @@ void GraphicsManager::initGraphics(bool noOpenGL) mainGraphics = new SafeOpenGLGraphics; mUseTextureSampler = false; break; +#endif case 3: imageHelper = new OpenGLImageHelper; sdlImageHelper = new SDLImageHelper; @@ -247,9 +249,13 @@ Graphics *GraphicsManager::createGraphics() return new Graphics; case 1: default: +#ifndef ANDROID return new NormalOpenGLGraphics; case 2: return new SafeOpenGLGraphics; +#endif + case 3: + return new MobileOpenGLGraphics; }; #else return new Graphics; diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 9eaf5be56..688519743 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -253,15 +253,20 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mOpenGLListModel = new OpenGLListModel; - mOpenGLDropDown = new DropDown(widget, mOpenGLListModel), - mOpenGLDropDown->setSelected(mOpenGLEnabled); - - mModeList->setEnabled(true); + mOpenGLDropDown = new DropDown(widget, mOpenGLListModel); -#ifndef USE_OPENGL +#ifdef USE_OPENGL +#ifdef ANDROID + if (mOpenGLEnabled == 1 || mOpenGLEnabled == 2) + mOpenGLEnabled = 3; +#endif + mOpenGLDropDown->setSelected(mOpenGLEnabled); +#else mOpenGLDropDown->setSelected(0); #endif + mModeList->setEnabled(true); + mFpsLabel->setCaption(mFps > 0 ? toString(mFps) : _("None")); mFpsLabel->setWidth(60); mAltFpsLabel->setCaption(_("Alt FPS limit: ") + (mAltFps > 0 diff --git a/src/normalopenglgraphics.cpp b/src/normalopenglgraphics.cpp index 61f58dadf..7fb4a7786 100644 --- a/src/normalopenglgraphics.cpp +++ b/src/normalopenglgraphics.cpp @@ -21,8 +21,7 @@ */ #include "main.h" - -#ifdef USE_OPENGL +#if defined USE_OPENGL && !defined ANDROID #include "normalopenglgraphics.h" diff --git a/src/normalopenglgraphics.h b/src/normalopenglgraphics.h index 144a5b3ee..2e07de42f 100644 --- a/src/normalopenglgraphics.h +++ b/src/normalopenglgraphics.h @@ -24,7 +24,7 @@ #define NORMALOPENGLGRAPHICS_H #include "main.h" -#ifdef USE_OPENGL +#if defined USE_OPENGL && !defined ANDROID #include "localconsts.h" #include "graphics.h" diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index 3f825d9db..7e5c77c7f 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -218,12 +218,17 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage) glGenTextures(1, &texture); switch (mUseOpenGL) { +#ifndef ANDROID case 1: NormalOpenGLGraphics::bindTexture(mTextureType, texture); break; case 2: SafeOpenGLGraphics::bindTexture(mTextureType, texture); break; +#else + case 1: + case 2: +#endif case 3: MobileOpenGLGraphics::bindTexture(mTextureType, texture); break; @@ -250,7 +255,9 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage) glTexParameteri(mTextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST); } } +#ifndef ANDROID glTexParameteri(mTextureType, GL_TEXTURE_MAX_LEVEL, 0); +#endif glTexImage2D(mTextureType, 0, mInternalTextureType, tmpImage->w, tmpImage->h, diff --git a/src/safeopenglgraphics.cpp b/src/safeopenglgraphics.cpp index 113a33baa..f4ae7ba93 100644 --- a/src/safeopenglgraphics.cpp +++ b/src/safeopenglgraphics.cpp @@ -22,7 +22,7 @@ #include "main.h" -#ifdef USE_OPENGL +#if defined USE_OPENGL && !defined ANDROID #include "safeopenglgraphics.h" #include "configuration.h" diff --git a/src/safeopenglgraphics.h b/src/safeopenglgraphics.h index a21dc8505..e0f2d390a 100644 --- a/src/safeopenglgraphics.h +++ b/src/safeopenglgraphics.h @@ -23,8 +23,8 @@ #ifndef SAFEOPENGLGRAPHICS_H #define SAFEOPENGLGRAPHICS_H -#ifdef USE_OPENGL #include "main.h" +#if defined USE_OPENGL && !defined ANDROID #include "graphics.h" -- cgit v1.2.3-70-g09d2