From: Mikko Rasa Date: Tue, 6 Dec 2016 21:53:48 +0000 (+0200) Subject: Compute Framebuffer size correctly when texture mipmaps are attached X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=42c783eb553949aae85d5f5b5ea9d0d9776780e1;p=libs%2Fgl.git Compute Framebuffer size correctly when texture mipmaps are attached --- 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)