From 9abb51fce0cca32ebe267c4797363d99520c2a0a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 25 Oct 2012 21:43:32 +0300 Subject: Add initial version of mobile OpenGL backend. --- src/resources/image.cpp | 1 + src/resources/image.h | 1 + src/resources/openglimagehelper.cpp | 21 +++++++++++++++++---- src/resources/subimage.cpp | 1 + 4 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src/resources') diff --git a/src/resources/image.cpp b/src/resources/image.cpp index b342edcbf..c71cbdec9 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -26,6 +26,7 @@ #include "resources/resourcemanager.h" #ifdef USE_OPENGL +#include "mobileopenglgraphics.h" #include "normalopenglgraphics.h" #include "safeopenglgraphics.h" #endif diff --git a/src/resources/image.h b/src/resources/image.h index 36404b2b1..87a842aa3 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -64,6 +64,7 @@ class Image : public Resource friend class SDLImageHelper; #ifdef USE_OPENGL friend class AtlasManager; + friend class MobileOpenGLGraphics; friend class NormalOpenGLGraphics; friend class SafeOpenGLGraphics; #endif diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index a162ccf59..3f825d9db 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -29,6 +29,7 @@ #include "graphicsmanager.h" #include "logger.h" #include "mgl.h" +#include "mobileopenglgraphics.h" #include "normalopenglgraphics.h" #include "safeopenglgraphics.h" @@ -215,15 +216,27 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage) GLuint texture; glGenTextures(1, &texture); - if (mUseOpenGL == 1) - NormalOpenGLGraphics::bindTexture(mTextureType, texture); - else if (mUseOpenGL == 2) - SafeOpenGLGraphics::bindTexture(mTextureType, texture); + switch (mUseOpenGL) + { + case 1: + NormalOpenGLGraphics::bindTexture(mTextureType, texture); + break; + case 2: + SafeOpenGLGraphics::bindTexture(mTextureType, texture); + break; + case 3: + MobileOpenGLGraphics::bindTexture(mTextureType, texture); + break; + default: + logger->log("Unknown OpenGL backend: %d", mUseOpenGL); + break; + } if (SDL_MUSTLOCK(tmpImage)) SDL_LockSurface(tmpImage); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + if (!mUseTextureSampler) { if (mBlur) diff --git a/src/resources/subimage.cpp b/src/resources/subimage.cpp index a2d6a8c33..bb63f842a 100644 --- a/src/resources/subimage.cpp +++ b/src/resources/subimage.cpp @@ -23,6 +23,7 @@ #include "resources/subimage.h" #ifdef USE_OPENGL +#include "mobileopenglgraphics.h" #include "normalopenglgraphics.h" #include "safeopenglgraphics.h" #endif -- cgit v1.2.3-60-g2f50