summaryrefslogtreecommitdiff
path: root/src/render/safeopenglgraphics.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/safeopenglgraphics.cpp
parent226202ff807dc860991af0d6665ef9e9b48c1bed (diff)
downloadmanaverse-a0b2deb4192bddad4d061f5d5df86411a437f01f.tar.gz
manaverse-a0b2deb4192bddad4d061f5d5df86411a437f01f.tar.bz2
manaverse-a0b2deb4192bddad4d061f5d5df86411a437f01f.tar.xz
manaverse-a0b2deb4192bddad4d061f5d5df86411a437f01f.zip
add support for screen scale in OpenGL modes.
Diffstat (limited to 'src/render/safeopenglgraphics.cpp')
-rw-r--r--src/render/safeopenglgraphics.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp
index c6e8c1f30..bf9334655 100644
--- a/src/render/safeopenglgraphics.cpp
+++ b/src/render/safeopenglgraphics.cpp
@@ -53,11 +53,15 @@ SafeOpenGLGraphics::~SafeOpenGLGraphics()
{
}
-bool SafeOpenGLGraphics::setVideoMode(const int w, const int h, const int bpp,
- const bool fs, const bool hwaccel,
- const bool resize, const bool noFrame)
+bool SafeOpenGLGraphics::setVideoMode(const int w, const int h,
+ 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();
}
@@ -436,7 +440,8 @@ void SafeOpenGLGraphics::_beginDraw()
glLoadIdentity();
glOrtho(0.0, static_cast<double>(mRect.w),
- static_cast<double>(mRect.h), 0.0, -1.0, 1.0);
+ static_cast<double>(mRect.h),
+ 0.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
@@ -537,9 +542,10 @@ bool SafeOpenGLGraphics::pushClipArea(gcn::Rectangle area)
glPushMatrix();
glTranslatef(static_cast<GLfloat>(transX + clipArea.xOffset),
static_cast<GLfloat>(transY + clipArea.yOffset), 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;
}
@@ -552,8 +558,10 @@ void SafeOpenGLGraphics::popClipArea()
glPopMatrix();
const gcn::ClipRectangle &clipArea = mClipStack.top();
- 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 SafeOpenGLGraphics::drawPoint(int x, int y)