From 93a30ec5dd65df6f91e028e68f18d6a7965240da Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 10 Dec 2015 01:28:03 +0300 Subject: Add support for mobileopengl2 backend (still copy from modern opengl). --- src/resources/ambientlayer.cpp | 6 ++++-- src/resources/image.cpp | 16 ++++++++++------ src/resources/map/map.cpp | 10 ++++++---- src/resources/openglimagehelper.cpp | 9 ++++++++- 4 files changed, 28 insertions(+), 13 deletions(-) (limited to 'src/resources') diff --git a/src/resources/ambientlayer.cpp b/src/resources/ambientlayer.cpp index 454758e88..e03068a2b 100644 --- a/src/resources/ambientlayer.cpp +++ b/src/resources/ambientlayer.cpp @@ -51,7 +51,8 @@ AmbientLayer::AmbientLayer(Image *const img, if (!mImage) return; - if (keepRatio && imageHelper->useOpenGL() == RENDER_SOFTWARE) + if (keepRatio && + imageHelper->useOpenGL() == RENDER_SOFTWARE) { const int width = mainGraphics->mWidth; const int height = mainGraphics->mHeight; @@ -121,7 +122,8 @@ void AmbientLayer::draw(Graphics *const graphics, const int x, if (!mImage) return; - if (imageHelper->useOpenGL() == RENDER_SOFTWARE || !mKeepRatio) + if (imageHelper->useOpenGL() == RENDER_SOFTWARE || + !mKeepRatio) { graphics->drawPattern(mImage, static_cast(-mPosX), static_cast(-mPosY), x + static_cast(mPosX), diff --git a/src/resources/image.cpp b/src/resources/image.cpp index ef15a26b2..8b952779c 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -440,13 +440,17 @@ Image *Image::getSubImage(const int x, const int y, // Create a new clipped sub-image #ifdef USE_OPENGL const RenderType mode = OpenGLImageHelper::mUseOpenGL; - if (mode == RENDER_NORMAL_OPENGL - || mode == RENDER_SAFE_OPENGL - || mode == RENDER_GLES_OPENGL - || mode == RENDER_MODERN_OPENGL) + if (mode == RENDER_NORMAL_OPENGL || + mode == RENDER_SAFE_OPENGL || + mode == RENDER_GLES_OPENGL || + mode == RENDER_GLES2_OPENGL || + mode == RENDER_MODERN_OPENGL) { - return new SubImage(this, mGLImage, x, y, width, height, - mTexWidth, mTexHeight); + return new SubImage(this, + mGLImage, + x, y, + width, height, + mTexWidth, mTexHeight); } #endif diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index d0c091186..2471b79c2 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -138,9 +138,10 @@ Map::Map(const int width, const int height, mRedrawMap(true), mBeingOpacity(false), #ifdef USE_OPENGL - mCachedDraw(mOpenGL == RENDER_NORMAL_OPENGL - || mOpenGL == RENDER_GLES_OPENGL - || mOpenGL == RENDER_MODERN_OPENGL), + mCachedDraw(mOpenGL == RENDER_NORMAL_OPENGL || + mOpenGL == RENDER_GLES_OPENGL || + mOpenGL == RENDER_GLES2_OPENGL || + mOpenGL == RENDER_MODERN_OPENGL), #else mCachedDraw(false), #endif @@ -1406,7 +1407,8 @@ void Map::reduce() #ifdef USE_SDL2 return; #else - if (!mFringeLayer || mOpenGL != RENDER_SOFTWARE || + if (!mFringeLayer || + mOpenGL != RENDER_SOFTWARE || !config.getBoolValue("enableMapReduce")) { return; diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index bf051fc0c..b1ddc185e 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -29,6 +29,7 @@ #include "render/mgl.h" #include "render/mglcheck.h" +#include "render/mobileopengl2graphics.h" #include "render/mobileopenglgraphics.h" #include "render/modernopenglgraphics.h" #include "render/normalopenglgraphics.h" @@ -266,6 +267,9 @@ void OpenGLImageHelper::bindTexture(const GLuint texture) case RENDER_GLES_OPENGL: MobileOpenGLGraphics::bindTexture(mTextureType, texture); break; + case RENDER_GLES2_OPENGL: + MobileOpenGL2Graphics::bindTexture(mTextureType, texture); + break; case RENDER_SOFTWARE: case RENDER_SDL2_DEFAULT: case RENDER_NULL: @@ -305,8 +309,11 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, if (SDL_MUSTLOCK(tmpImage)) SDL_LockSurface(tmpImage); - if (mUseOpenGL != RENDER_MODERN_OPENGL && mUseOpenGL != RENDER_GLES_OPENGL) + if (mUseOpenGL != RENDER_MODERN_OPENGL && + mUseOpenGL != RENDER_GLES_OPENGL) + { glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + } if (!mUseTextureSampler) { -- cgit v1.2.3-60-g2f50