]> git.tdb.fi Git - libs/gl.git/blobdiff - source/bloom.cpp
Remove support for texture borders
[libs/gl.git] / source / bloom.cpp
index 5f2adc85c2bf592a8379d58ee9d3efc228fe055a..7c4338f8e1fe975706b677ec810e42b9dd91bd36 100644 (file)
@@ -75,9 +75,9 @@ Bloom::Bloom(unsigned w, unsigned h):
        for(unsigned i=0; i<2; ++i)
        {
                blur_shdata[i].uniform(loc, 0);
-               tex[i].storage(RGB16F, w, h, 0);
-               tex[i].image(0, RGB, UNSIGNED_BYTE, 0);
                tex[i].set_min_filter(NEAREST);
+               tex[i].storage(RGB16F, w, h);
+               tex[i].image(0, RGB, UNSIGNED_BYTE, 0);
        }
 
        combine_shdata.uniform(combine_shader.get_uniform_location("source"), 1);
@@ -133,8 +133,8 @@ void Bloom::render(const Texture2D &src)
        blur_shader.bind();
        fbo.bind();
        src.bind_to(0);
-       disable(DEPTH_TEST);
-       disable(BLEND);
+       Bind unbind_dtest(static_cast<DepthTest *>(0), true);
+       Bind unbind_blend(static_cast<Blend *>(0), true);
        for(unsigned i=0; i<2; ++i)
        {
                fbo.attach(COLOR_ATTACHMENT0, tex[i], 0);
@@ -153,12 +153,8 @@ void Bloom::render(const Texture2D &src)
        src.bind_to(1);
        quad.draw();
        Program::unbind();
-       Texture::unbind();
-       TexUnit::activate(0);
-       Texture::unbind();
-       // XXX Should check if the modes were enabled in the first place
-       enable(DEPTH_TEST);
-       enable(BLEND);
+       Texture::unbind_from(1);
+       Texture::unbind_from(0);
 }
 
 } // namespace GL