From bd8db7e66b6b0d003e268dd7f8a549ef91ebc8b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 10 Jan 2015 23:34:32 +0100 Subject: [PATCH] Don't reset viewport if binding framebuffer for reading only. Caused assertion. Anyway, I need to clean up that mess with framebuffer binding. Nobody needs to bind it for reading. --- src/Magnum/AbstractFramebuffer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Magnum/AbstractFramebuffer.cpp b/src/Magnum/AbstractFramebuffer.cpp index eef8e6a48..80a70cce1 100644 --- a/src/Magnum/AbstractFramebuffer.cpp +++ b/src/Magnum/AbstractFramebuffer.cpp @@ -93,9 +93,12 @@ void AbstractFramebuffer::createIfNotAlready() { CORRADE_INTERNAL_ASSERT(_created); } -void AbstractFramebuffer::bind(FramebufferTarget target) { +void AbstractFramebuffer::bind(const FramebufferTarget target) { bindInternal(target); - setViewportInternal(); + + /* Ensure the viewport is set if the user is going to draw */ + if(target == FramebufferTarget::Draw || target == FramebufferTarget::ReadDraw) + setViewportInternal(); } void AbstractFramebuffer::bindInternal(FramebufferTarget target) {