diff --git a/lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp b/lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp index af5bae0f6..dfc96b00e 100644 --- a/lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp +++ b/lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp @@ -2706,8 +2706,14 @@ namespace video void COGLES2Driver::enableScissorTest(const core::rect& r) { glEnable(GL_SCISSOR_TEST); - glScissor(r.UpperLeftCorner.X, r.UpperLeftCorner.Y, - r.getWidth(), r.getHeight()); + // The x​ and y​ is the window-space lower-left position of the scissor box, + // and width​ and height​ define the size of the rectangle. + s32 y = (s32)getCurrentRenderTargetSize().Height - r.LowerRightCorner.Y; + core::rect rect_reverse(r.UpperLeftCorner.X, y, + r.UpperLeftCorner.X + r.getWidth(), + y + r.getHeight()); + glScissor(rect_reverse.UpperLeftCorner.X, rect_reverse.UpperLeftCorner.Y, + rect_reverse.getWidth(), rect_reverse.getHeight()); } void COGLES2Driver::disableScissorTest() diff --git a/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp b/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp index 8d2f67a27..16ded9a90 100644 --- a/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp +++ b/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp @@ -4942,8 +4942,14 @@ GLenum COpenGLDriver::getZBufferBits() const void COpenGLDriver::enableScissorTest(const core::rect& r) { glEnable(GL_SCISSOR_TEST); - glScissor(r.UpperLeftCorner.X, r.UpperLeftCorner.Y, - r.getWidth(), r.getHeight()); + // The x​ and y​ is the window-space lower-left position of the scissor box, + // and width​ and height​ define the size of the rectangle. + s32 y = (s32)getCurrentRenderTargetSize().Height - r.LowerRightCorner.Y; + core::rect rect_reverse(r.UpperLeftCorner.X, y, + r.UpperLeftCorner.X + r.getWidth(), + y + r.getHeight()); + glScissor(rect_reverse.UpperLeftCorner.X, rect_reverse.UpperLeftCorner.Y, + rect_reverse.getWidth(), rect_reverse.getHeight()); } void COpenGLDriver::disableScissorTest() diff --git a/src/font/font_drawer.cpp b/src/font/font_drawer.cpp index debc2879f..bf4e2b644 100644 --- a/src/font/font_drawer.cpp +++ b/src/font/font_drawer.cpp @@ -164,15 +164,7 @@ void FontDrawer::draw() } if (g_clip) - { - const core::dimension2d& render_target_size = - irr_driver->getActualScreenSize(); - s32 y = (s32)render_target_size.Height - g_clip->LowerRightCorner.Y; - core::rect r(g_clip->UpperLeftCorner.X, y, - g_clip->UpperLeftCorner.X + g_clip->getWidth(), - y + g_clip->getHeight()); - irr_driver->getVideoDriver()->enableScissorTest(r); - } + irr_driver->getVideoDriver()->enableScissorTest(*g_clip); else irr_driver->getVideoDriver()->disableScissorTest();