summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-12-10 01:28:03 +0300
committerAndrei Karas <akaras@inbox.ru>2015-12-10 01:33:59 +0300
commit93a30ec5dd65df6f91e028e68f18d6a7965240da (patch)
treef2a7908d565dd1e6f856e8c058fbc40f50dbb1cb /src/resources
parent07daba6efa05a59271ce4173a2b500b27773e523 (diff)
downloadmv-93a30ec5dd65df6f91e028e68f18d6a7965240da.tar.gz
mv-93a30ec5dd65df6f91e028e68f18d6a7965240da.tar.bz2
mv-93a30ec5dd65df6f91e028e68f18d6a7965240da.tar.xz
mv-93a30ec5dd65df6f91e028e68f18d6a7965240da.zip
Add support for mobileopengl2 backend (still copy from modern opengl).
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/ambientlayer.cpp6
-rw-r--r--src/resources/image.cpp16
-rw-r--r--src/resources/map/map.cpp10
-rw-r--r--src/resources/openglimagehelper.cpp9
4 files changed, 28 insertions, 13 deletions
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<int>(-mPosX),
static_cast<int>(-mPosY), x + static_cast<int>(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)
{