diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-22 11:59:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-24 21:08:15 +0300 |
commit | 2480ea4cc668ff99007dd6fb8b44911eea5d5287 (patch) | |
tree | c8fc22a9612d30474cddd6d40da5269ffd7f55a5 /src/normalopenglgraphics.cpp | |
parent | 07390a4c8dcde85602c1a91d3773061d67d169ab (diff) | |
download | manaverse-2480ea4cc668ff99007dd6fb8b44911eea5d5287.tar.gz manaverse-2480ea4cc668ff99007dd6fb8b44911eea5d5287.tar.bz2 manaverse-2480ea4cc668ff99007dd6fb8b44911eea5d5287.tar.xz manaverse-2480ea4cc668ff99007dd6fb8b44911eea5d5287.zip |
store window size into rectangle.
Diffstat (limited to 'src/normalopenglgraphics.cpp')
-rw-r--r-- | src/normalopenglgraphics.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/normalopenglgraphics.cpp b/src/normalopenglgraphics.cpp index ac933a6ac..089077224 100644 --- a/src/normalopenglgraphics.cpp +++ b/src/normalopenglgraphics.cpp @@ -1052,12 +1052,15 @@ void NormalOpenGLGraphics::_beginDraw() glMatrixMode(GL_PROJECTION); glLoadIdentity(); + const int w = mRect.w; + const int h = mRect.h; + #ifdef ANDROID - glOrthof(0.0, static_cast<float>(mWindow->w), - static_cast<float>(mWindow->h), 0.0, -1.0, 1.0); + glOrthof(0.0, static_cast<float>(w), static_cast<float>(h), + 0.0, -1.0, 1.0); #else - glOrtho(0.0, static_cast<double>(mWindow->w), - static_cast<double>(mWindow->h), 0.0, -1.0, 1.0); + glOrtho(0.0, static_cast<double>(w), static_cast<double>(h), + 0.0, -1.0, 1.0); #endif glMatrixMode(GL_MODELVIEW); @@ -1092,7 +1095,7 @@ void NormalOpenGLGraphics::_beginDraw() // glScalef(0.5f, 0.5f, 0.5f); - pushClipArea(gcn::Rectangle(0, 0, mWindow->w, mWindow->h)); + pushClipArea(gcn::Rectangle(0, 0, w, h)); } void NormalOpenGLGraphics::_endDraw() @@ -1103,13 +1106,13 @@ void NormalOpenGLGraphics::_endDraw() void NormalOpenGLGraphics::prepareScreenshot() { if (config.getBoolValue("usefbo")) - graphicsManager.createFBO(mWindow->w, mWindow->h, &mFbo); + graphicsManager.createFBO(mRect.w, mRect.h, &mFbo); } SDL_Surface* NormalOpenGLGraphics::getScreenshot() { - const int h = mWindow->h; - const int w = mWindow->w - (mWindow->w % 4); + const int h = mRect.h; + const int w = mRect.w - (mRect.w % 4); GLint pack = 1; SDL_Surface *const screenshot = SDL_CreateRGBSurface( @@ -1181,7 +1184,7 @@ bool NormalOpenGLGraphics::pushClipArea(gcn::Rectangle area) glTranslatef(static_cast<GLfloat>(transX), static_cast<GLfloat>(transY), 0); } - glScissor(clipArea.x, mWindow->h - clipArea.y - clipArea.height, + glScissor(clipArea.x, mRect.h - clipArea.y - clipArea.height, clipArea.width, clipArea.height); return result; @@ -1196,7 +1199,7 @@ void NormalOpenGLGraphics::popClipArea() glPopMatrix(); const gcn::ClipRectangle &clipArea = mClipStack.top(); - glScissor(clipArea.x, mWindow->h - clipArea.y - clipArea.height, + glScissor(clipArea.x, mRect.h - clipArea.y - clipArea.height, clipArea.width, clipArea.height); } |