diff --git a/src/modules/graphics/opengl/Framebuffer.cpp b/src/modules/graphics/opengl/Framebuffer.cpp index c1df8a113..54185909b 100644 --- a/src/modules/graphics/opengl/Framebuffer.cpp +++ b/src/modules/graphics/opengl/Framebuffer.cpp @@ -372,6 +372,16 @@ namespace opengl strategy->deleteFBO(fbo, depthbuffer, img); } + int Framebuffer::getWidth() + { + return width; + } + + int Framebuffer::getHeight() + { + return height; + } + } // opengl } // graphics } // love diff --git a/src/modules/graphics/opengl/Framebuffer.h b/src/modules/graphics/opengl/Framebuffer.h index 50f2f1e3d..b59697c4b 100644 --- a/src/modules/graphics/opengl/Framebuffer.h +++ b/src/modules/graphics/opengl/Framebuffer.h @@ -41,6 +41,9 @@ namespace opengl void setWrap(const Image::Wrap &w); Image::Wrap getWrap() const; + int getWidth(); + int getHeight(); + bool loadVolatile(); void unloadVolatile(); diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index a404423a9..90191e3e8 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -365,6 +365,13 @@ namespace opengl return currentMode.height; } + int Graphics::getRenderHeight() + { + if (Framebuffer::current) + return Framebuffer::current->getHeight(); + return currentMode.height; + } + bool Graphics::isCreated() { return (currentMode.width > 0) || (currentMode.height > 0); @@ -409,7 +416,7 @@ namespace opengl void Graphics::setScissor(int x, int y, int width, int height) { glEnable(GL_SCISSOR_TEST); - glScissor(x, getHeight() - (y + height), width, height); // Compensates for the fact that our y-coordinate is reverse of OpenGLs. + glScissor(x, getRenderHeight() - (y + height), width, height); // Compensates for the fact that our y-coordinate is reverse of OpenGLs. } void Graphics::setScissor() @@ -426,7 +433,7 @@ namespace opengl glGetIntegerv(GL_SCISSOR_BOX, scissor); lua_pushnumber(L, scissor[0]); - lua_pushnumber(L, getHeight() - (scissor[1] + scissor[3])); // Compensates for the fact that our y-coordinate is reverse of OpenGLs. + lua_pushnumber(L, getRenderHeight() - (scissor[1] + scissor[3])); // Compensates for the fact that our y-coordinate is reverse of OpenGLs. lua_pushnumber(L, scissor[2]); lua_pushnumber(L, scissor[3]); diff --git a/src/modules/graphics/opengl/Graphics.h b/src/modules/graphics/opengl/Graphics.h index 7f1b88e09..503c40961 100644 --- a/src/modules/graphics/opengl/Graphics.h +++ b/src/modules/graphics/opengl/Graphics.h @@ -118,6 +118,8 @@ namespace opengl GLint matrixLimit; GLint userMatrices; + int getRenderHeight(); + public: Graphics();