X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fframebuffer.cpp;h=8806ea6c4956d980dafd2b72419050e78813c2d8;hb=e003d7a1497dad3b13e4e88e681f8fa2afc40c83;hp=6877f4808b7402c7f1660097c3860bb7fcbbe5bc;hpb=2e7f19b895424c3a77940e648639f8df2b395d0f;p=libs%2Fgl.git diff --git a/source/framebuffer.cpp b/source/framebuffer.cpp index 6877f480..8806ea6c 100644 --- a/source/framebuffer.cpp +++ b/source/framebuffer.cpp @@ -60,6 +60,11 @@ void Framebuffer::update_attachment(unsigned mask) const static_cast(attch.tex)->allocate(attch.level); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attch.attachment, attch.type, attch.tex->get_id(), attch.level); } + else if(attch.type==GL_TEXTURE_CUBE_MAP) + { + static_cast(attch.tex)->allocate(attch.level); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attch.attachment, attch.cube_face, attch.tex->get_id(), attch.level); + } else glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, attch.attachment, 0, 0); } @@ -90,6 +95,11 @@ void Framebuffer::check_size() width = tex->get_width(); height = tex->get_height(); } + else if(i->type==GL_TEXTURE_CUBE_MAP) + { + width = static_cast(i->tex)->get_size(); + height = width; + } if(current()==this) glViewport(0, 0, width, height); break; @@ -113,7 +123,18 @@ void Framebuffer::attach(FramebufferAttachment attch, Texture2D &tex, unsigned l throw invalid_operation("Framebuffer::attach"); unsigned i = get_attachment_index(attch); - attachments[i].set(tex, level); + attachments[i].set(tex, 0, level); + update_attachment(1<