]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/framebuffer.cpp
Specify underlying type for format descriptor enums
[libs/gl.git] / source / core / framebuffer.cpp
index e9d8863ca16e4e0379a11e9777def136cb596d2e..851b6431b2fb134d470b1116262411af471532be 100644 (file)
@@ -131,9 +131,9 @@ void Framebuffer::update() const
        vector<GLenum> color_bufs;
        color_bufs.reserve(format.size());
        unsigned i = 0;
-       for(const uint16_t *j=format.begin(); j!=format.end(); ++j, ++i)
+       for(FrameAttachment a: format)
        {
-               GLenum gl_attach_point = get_gl_attachment(static_cast<FrameAttachment>(*j));
+               GLenum gl_attach_point = get_gl_attachment(a);
                if(dirty&(1<<i))
                {
                        const Attachment &attch = attachments[i];
@@ -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,14 +256,17 @@ void Framebuffer::set_attachment(FrameAttachment attch, Texture &tex, unsigned l
                throw incompatible_data("Framebuffer::attach");
 
        unsigned i = 0;
-       for(const uint16_t *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<<i;
                        check_size();
                        return;
                }
+               ++i;
+       }
 
        throw incompatible_data("Framebuffer::attach");
 }