summaryrefslogtreecommitdiff
path: root/src/render/normalopenglgraphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-28 00:30:51 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-28 23:35:20 +0300
commita0b2deb4192bddad4d061f5d5df86411a437f01f (patch)
tree4739472959d83045eac4d7f7ddf3dc265d37b45c /src/render/normalopenglgraphics.cpp
parent226202ff807dc860991af0d6665ef9e9b48c1bed (diff)
downloadmanaplus-a0b2deb4192bddad4d061f5d5df86411a437f01f.tar.gz
manaplus-a0b2deb4192bddad4d061f5d5df86411a437f01f.tar.bz2
manaplus-a0b2deb4192bddad4d061f5d5df86411a437f01f.tar.xz
manaplus-a0b2deb4192bddad4d061f5d5df86411a437f01f.zip
add support for screen scale in OpenGL modes.
Diffstat (limited to 'src/render/normalopenglgraphics.cpp')
-rw-r--r--src/render/normalopenglgraphics.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index 5b7abd895..e8e1a2116 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -140,11 +140,14 @@ void NormalOpenGLGraphics::initArrays()
}
bool NormalOpenGLGraphics::setVideoMode(const int w, const int h,
- const int bpp, const bool fs,
- const bool hwaccel, const bool resize,
+ const int scale,
+ const int bpp,
+ const bool fs,
+ const bool hwaccel,
+ const bool resize,
const bool noFrame)
{
- setMainFlags(w, h, bpp, fs, hwaccel, resize, noFrame);
+ setMainFlags(w, h, scale, bpp, fs, hwaccel, resize, noFrame);
return setOpenGLMode();
}
@@ -1103,10 +1106,12 @@ void NormalOpenGLGraphics::_beginDraw()
const int h = mRect.h;
#ifdef ANDROID
- glOrthof(0.0, static_cast<float>(w), static_cast<float>(h),
+ glOrthof(0.0, static_cast<float>(w),
+ static_cast<float>(h),
0.0, -1.0, 1.0);
#else
- glOrtho(0.0, static_cast<double>(w), static_cast<double>(h),
+ glOrtho(0.0, static_cast<double>(w),
+ static_cast<double>(h),
0.0, -1.0, 1.0);
#endif
@@ -1229,8 +1234,10 @@ bool NormalOpenGLGraphics::pushClipArea(gcn::Rectangle area)
glTranslatef(static_cast<GLfloat>(transX),
static_cast<GLfloat>(transY), 0);
}
- glScissor(clipArea.x, mRect.h - clipArea.y - clipArea.height,
- clipArea.width, clipArea.height);
+ glScissor(clipArea.x * mScale,
+ (mRect.h - clipArea.y - clipArea.height) * mScale,
+ clipArea.width * mScale,
+ clipArea.height * mScale);
return result;
}
@@ -1257,8 +1264,10 @@ void NormalOpenGLGraphics::popClipArea()
glTranslatef(static_cast<GLfloat>(transX),
static_cast<GLfloat>(transY), 0);
}
- glScissor(clipArea.x, mRect.h - clipArea.y - clipArea.height,
- clipArea.width, clipArea.height);
+ glScissor(clipArea.x * mScale,
+ (mRect.h - clipArea.y - clipArea.height) * mScale,
+ clipArea.width * mScale,
+ clipArea.height * mScale);
}
void NormalOpenGLGraphics::drawPoint(int x, int y)