X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fframebuffer.cpp;h=ea28d5db2d261eeb999d1e6c05eea38b6aefe70a;hb=df1f68d366e145716225f1a4dd223b0129280fb2;hp=77ac21be6b0e6ef76da3928247b54b2c69074c5b;hpb=c4cacaf8f9225e006e6bb35f81eb6c2f78602bdc;p=libs%2Fgl.git diff --git a/source/framebuffer.cpp b/source/framebuffer.cpp index 77ac21be..ea28d5db 100644 --- a/source/framebuffer.cpp +++ b/source/framebuffer.cpp @@ -53,7 +53,6 @@ void Framebuffer::update_attachment(unsigned mask) const if(current()==this) { GLenum color_buf = GL_NONE; - bool has_depth = false; for(unsigned i=0; iget_id()); else if(attch.type==GL_TEXTURE_2D) + { + static_cast(attch.tex)->allocate(attch.level); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attch.attachment, attch.type, attch.tex->get_id(), attch.level); + } else glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, attch.attachment, 0, 0); } if(attch.attachment>=COLOR_ATTACHMENT0 && attch.attachment<=COLOR_ATTACHMENT3) color_buf = attch.attachment; - if(attch.attachment==DEPTH_ATTACHMENT) - has_depth = true; } glDrawBuffer(color_buf); - glDepthMask(has_depth); } else dirty |= mask; @@ -113,7 +112,7 @@ void Framebuffer::attach(FramebufferAttachment attch, Renderbuffer &rbuf) check_size(); } -void Framebuffer::attach(FramebufferAttachment attch, Texture2D &tex, int level) +void Framebuffer::attach(FramebufferAttachment attch, Texture2D &tex, unsigned level) { if(!id) throw InvalidState("Can't attach to system framebuffer"); @@ -203,7 +202,7 @@ void Framebuffer::Attachment::set(Renderbuffer &r) level = 0; } -void Framebuffer::Attachment::set(Texture &t, int l) +void Framebuffer::Attachment::set(Texture &t, unsigned l) { type = t.get_target(); tex = &t;