summaryrefslogtreecommitdiff
path: root/src
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
parent07daba6efa05a59271ce4173a2b500b27773e523 (diff)
downloadmanaplus-93a30ec5dd65df6f91e028e68f18d6a7965240da.tar.gz
manaplus-93a30ec5dd65df6f91e028e68f18d6a7965240da.tar.bz2
manaplus-93a30ec5dd65df6f91e028e68f18d6a7965240da.tar.xz
manaplus-93a30ec5dd65df6f91e028e68f18d6a7965240da.zip
Add support for mobileopengl2 backend (still copy from modern opengl).
Diffstat (limited to 'src')
-rw-r--r--src/graphicsmanager.cpp35
-rw-r--r--src/gui/widgets/desktop.cpp4
-rw-r--r--src/gui/widgets/tabs/debugwindowtabs.cpp6
-rw-r--r--src/render/graphics.cpp1
-rw-r--r--src/render/renderers.cpp4
-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
9 files changed, 66 insertions, 25 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 719f072c6..05e4de782 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -48,6 +48,7 @@
#include "render/mglcheck.h"
#include "render/mgl.h"
#include "render/mglemu.h"
+#include "render/mobileopengl2graphics.h"
#include "render/mobileopenglgraphics.h"
#include "render/modernopenglgraphics.h"
#include "render/normalopenglgraphics.h"
@@ -306,6 +307,12 @@ void GraphicsManager::createRenderers()
mainGraphics = new ModernOpenGLGraphics;
mUseTextureSampler = true;
break;
+ case RENDER_GLES2_OPENGL:
+ imageHelper = new OpenGLImageHelper;
+ surfaceImageHelper = new SurfaceImageHelper;
+ mainGraphics = new MobileOpenGL2Graphics;
+ mUseTextureSampler = false;
+ break;
#endif
case RENDER_GLES_OPENGL:
imageHelper = new OpenGLImageHelper;
@@ -323,11 +330,12 @@ void GraphicsManager::createRenderers()
break;
#endif
};
- mUseAtlases = (useOpenGL == RENDER_NORMAL_OPENGL
- || useOpenGL == RENDER_SAFE_OPENGL
- || useOpenGL == RENDER_MODERN_OPENGL
- || useOpenGL == RENDER_GLES_OPENGL)
- && config.getBoolValue("useAtlases");
+ mUseAtlases = (useOpenGL == RENDER_NORMAL_OPENGL ||
+ useOpenGL == RENDER_SAFE_OPENGL ||
+ useOpenGL == RENDER_MODERN_OPENGL ||
+ useOpenGL == RENDER_GLES_OPENGL ||
+ useOpenGL == RENDER_GLES2_OPENGL) &&
+ config.getBoolValue("useAtlases");
#else // USE_OPENGL
@@ -346,6 +354,7 @@ void GraphicsManager::createRenderers()
case RENDER_SOFTWARE:
case RENDER_SAFE_OPENGL:
case RENDER_GLES_OPENGL:
+ case RENDER_GLES2_OPENGL:
case RENDER_MODERN_OPENGL:
case RENDER_NORMAL_OPENGL:
case RENDER_NULL:
@@ -487,6 +496,15 @@ void GraphicsManager::initGraphics()
openGLMode = RENDER_SAFE_OPENGL;
}
}
+ if (openGLMode == RENDER_GLES2_OPENGL)
+ {
+ // +++ here need check also not implimented gles flag
+ if (!checkGLVersion(2, 0))
+ {
+ logger->log("Fallback to safe OpenGL mode");
+ openGLMode = RENDER_SAFE_OPENGL;
+ }
+ }
if (openGLMode != oldOpenGLMode && !settings.options.test.empty())
{
deleteRenderers();
@@ -732,9 +750,10 @@ void GraphicsManager::updateTextureFormat() const
const int renderer = settings.options.renderer;
// using default formats
- if (renderer == RENDER_MODERN_OPENGL
- || renderer == RENDER_GLES_OPENGL
- || config.getBoolValue("newtextures"))
+ if (renderer == RENDER_MODERN_OPENGL ||
+ renderer == RENDER_GLES_OPENGL ||
+ renderer == RENDER_GLES2_OPENGL ||
+ config.getBoolValue("newtextures"))
{
OpenGLImageHelper::setInternalTextureType(GL_RGBA);
logger->log1("using RGBA texture format");
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 9fdc11a61..27fb7dff3 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -183,8 +183,8 @@ void Desktop::setBestFittingWallpaper()
const int height = rect.height;
if (imageHelper->useOpenGL() == RENDER_SOFTWARE &&
- (nWallPaper->getWidth() != width
- || nWallPaper->getHeight() != height))
+ (nWallPaper->getWidth() != width ||
+ nWallPaper->getHeight() != height))
{
// We rescale to obtain a fullscreen wallpaper...
Image *const newRsclWlPpr = resourceManager->getRescaled(
diff --git a/src/gui/widgets/tabs/debugwindowtabs.cpp b/src/gui/widgets/tabs/debugwindowtabs.cpp
index 1dfd56c1a..9fcba548f 100644
--- a/src/gui/widgets/tabs/debugwindowtabs.cpp
+++ b/src/gui/widgets/tabs/debugwindowtabs.cpp
@@ -108,7 +108,11 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) :
break;
case RENDER_GLES_OPENGL:
// TRANSLATORS: debug window label
- mFPSText = _("%d FPS (mobile OpenGL)");
+ mFPSText = _("%d FPS (mobile OpenGL ES)");
+ break;
+ case RENDER_GLES2_OPENGL:
+ // TRANSLATORS: debug window label
+ mFPSText = _("%d FPS (mobile OpenGL ES 2)");
break;
case RENDER_MODERN_OPENGL:
// TRANSLATORS: debug window label
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index 1e2e7884d..613a87b89 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -312,6 +312,7 @@ bool Graphics::setOpenGLMode()
if (rectTex
&& OpenGLImageHelper::getInternalTextureType() == 4
&& getOpenGL() != RENDER_GLES_OPENGL
+ && getOpenGL() != RENDER_GLES2_OPENGL
&& getOpenGL() != RENDER_MODERN_OPENGL
&& config.getBoolValue("rectangulartextures")
&& !graphicsManager.isUseTextureSampler())
diff --git a/src/render/renderers.cpp b/src/render/renderers.cpp
index 9c0834e85..7af602548 100644
--- a/src/render/renderers.cpp
+++ b/src/render/renderers.cpp
@@ -51,6 +51,7 @@ RenderType intToRenderType(const int mode)
&& mode != RENDER_MODERN_OPENGL
&& mode != RENDER_SAFE_OPENGL
&& mode != RENDER_GLES_OPENGL
+ && mode != RENDER_GLES2_OPENGL
&& mode != RENDER_SDL2_DEFAULT)
#elif !defined(USE_OPENGL) && defined(USE_SDL2)
&& mode != RENDER_SDL2_DEFAULT)
@@ -60,7 +61,8 @@ RenderType intToRenderType(const int mode)
&& mode != RENDER_NORMAL_OPENGL
&& mode != RENDER_MODERN_OPENGL
&& mode != RENDER_SAFE_OPENGL
- && mode != RENDER_GLES_OPENGL)
+ && mode != RENDER_GLES_OPENGL
+ && mode != RENDER_GLES2_OPENGL)
#endif
{
return getDefault();
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)
{