X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fframebuffer.cpp;h=a60b437eff6fbe9e4c9a1eec8e2b6012b35395af;hb=4a639bc5e80fce2467855a9e8f4c6cdff2f0adc0;hp=0ce00becd23d5503ca5f26fec5f13eab065f9f17;hpb=e9a898f315b5d1396f196d785913a283c30940f2;p=libs%2Fgl.git diff --git a/source/core/framebuffer.cpp b/source/core/framebuffer.cpp index 0ce00bec..a60b437e 100644 --- a/source/core/framebuffer.cpp +++ b/source/core/framebuffer.cpp @@ -131,9 +131,9 @@ void Framebuffer::update() const vector color_bufs; color_bufs.reserve(format.size()); unsigned i = 0; - for(const UInt16 *j=format.begin(); j!=format.end(); ++j, ++i) + for(FrameAttachment a: format) { - GLenum gl_attach_point = get_gl_attachment(static_cast(*j)); + GLenum gl_attach_point = get_gl_attachment(a); if(dirty&(1<get_id(), attch.level, attch.layer); else if(type==GL_TEXTURE_CUBE_MAP) - glFramebufferTexture2D(GL_FRAMEBUFFER, gl_attach_point, TextureCube::enumerate_faces(attch.layer), attch.tex->get_id(), attch.level); + glFramebufferTexture2D(GL_FRAMEBUFFER, gl_attach_point, get_gl_cube_face(static_cast(attch.layer)), attch.tex->get_id(), attch.level); } else if(ARB_direct_state_access) glNamedFramebufferTexture(id, gl_attach_point, 0, 0); @@ -166,6 +166,8 @@ void Framebuffer::update() const if(gl_attach_point!=GL_DEPTH_ATTACHMENT && gl_attach_point!=GL_STENCIL_ATTACHMENT) color_bufs.push_back(gl_attach_point); + + ++i; } if(color_bufs.size()>1) @@ -254,21 +256,23 @@ void Framebuffer::set_attachment(FrameAttachment attch, Texture &tex, unsigned l throw incompatible_data("Framebuffer::attach"); unsigned i = 0; - for(const UInt16 *j=format.begin(); j!=format.end(); ++j, ++i) - if(*j==attch) + for(FrameAttachment a: format) + { + if(a==attch) { attachments[i].set(tex, level, layer); dirty |= 1<