From 42c783eb553949aae85d5f5b5ea9d0d9776780e1 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 6 Dec 2016 23:53:48 +0200 Subject: [PATCH] Compute Framebuffer size correctly when texture mipmaps are attached --- source/framebuffer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/framebuffer.cpp b/source/framebuffer.cpp index 638a710f..a3197f59 100644 --- a/source/framebuffer.cpp +++ b/source/framebuffer.cpp @@ -168,12 +168,12 @@ void Framebuffer::check_size() else if(i->type==GL_TEXTURE_2D) { Texture2D *tex = static_cast(i->tex); - width = tex->get_width(); - height = tex->get_height(); + width = max(tex->get_width()>>i->level, 1U); + height = max(tex->get_height()>>i->level, 1U); } else if(i->type==GL_TEXTURE_CUBE_MAP) { - width = static_cast(i->tex)->get_size(); + width = max(static_cast(i->tex)->get_size()>>i->level, 1U); height = width; } if(full_viewport) -- 2.43.0