diff --git a/src/graphics/glwrap.cpp b/src/graphics/glwrap.cpp index 5eeb57e5f..117ec9f2c 100644 --- a/src/graphics/glwrap.cpp +++ b/src/graphics/glwrap.cpp @@ -564,11 +564,11 @@ void FrameBuffer::Blit(const FrameBuffer &Src, FrameBuffer &Dst, GLbitfield mask glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); } -void FrameBuffer::BlitToDefault() +void FrameBuffer::BlitToDefault(size_t x0, size_t y0, size_t x1, size_t y1) { glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_NEAREST); + glBlitFramebuffer(0, 0, width, height, x0, y0, x1, y1, GL_COLOR_BUFFER_BIT, GL_NEAREST); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); } diff --git a/src/graphics/glwrap.hpp b/src/graphics/glwrap.hpp index 526fa8373..de5c46a48 100644 --- a/src/graphics/glwrap.hpp +++ b/src/graphics/glwrap.hpp @@ -199,7 +199,7 @@ public: size_t getWidth() const { return width; } size_t getHeight() const { return height; } static void Blit(const FrameBuffer &Src, FrameBuffer &Dst, GLbitfield mask = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST); - void BlitToDefault(); + void BlitToDefault(size_t, size_t, size_t, size_t); }; // core::rect needs these includes diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 27516e045..32eb9d0e3 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -183,6 +183,8 @@ void IrrDriver::renderGLSL(float dt) } } + const core::recti &viewport = camera->getViewport(); + // Render the post-processed scene if (UserConfigParams::m_dynamic_lights) { @@ -192,11 +194,11 @@ void IrrDriver::renderGLSL(float dt) glEnable(GL_FRAMEBUFFER_SRGB); if (irr_driver->getNormals()) - irr_driver->getFBO(FBO_NORMAL_AND_DEPTHS); + irr_driver->getFBO(FBO_NORMAL_AND_DEPTHS).BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y); else if (irr_driver->getSSAOViz()) - irr_driver->getFBO(FBO_SSAO).BlitToDefault(); + irr_driver->getFBO(FBO_SSAO).BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y); else - fbo->BlitToDefault(); + fbo->BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y); if (!UserConfigParams::m_mlaa) glDisable(GL_FRAMEBUFFER_SRGB);