]> git.tdb.fi Git - libs/gl.git/blobdiff - source/ambientocclusion.cpp
Rework ProgramData to do less unnecessary work
[libs/gl.git] / source / ambientocclusion.cpp
index 278720cec48fac4903661f4f52010fa99a3b19b1..f42069bebae007ed15105e34536dada4a98eec98 100644 (file)
@@ -79,7 +79,9 @@ AmbientOcclusion::AmbientOcclusion(unsigned w, unsigned h, float depth_ratio):
        occlusion.storage(RGB, w, h);
        occlusion.set_min_filter(NEAREST);
        occlusion.set_mag_filter(NEAREST);
+       occlusion.set_wrap(CLAMP_TO_EDGE);
        fbo.attach(COLOR_ATTACHMENT0, occlusion, 0);
+       fbo.require_complete();
 
        combine_texturing.attach(2, occlusion);
 
@@ -133,11 +135,11 @@ void AmbientOcclusion::render(const Texture2D &color, const Texture2D &depth)
        combine_texturing.attach(0, depth);
        combine_texturing.attach(1, color);
 
-       Bind unbind_dtest(static_cast<DepthTest *>(0), true);
-       Bind unbind_blend(static_cast<Blend *>(0), true);
+       BindRestore unbind_dtest(static_cast<DepthTest *>(0));
+       BindRestore unbind_blend(static_cast<Blend *>(0));
 
        {
-               Bind bind_fbo(fbo, true);
+               BindRestore bind_fbo(fbo);
                Bind bind_tex(occlude_texturing);
                Bind bind_shader(occlude_shader);
                occlude_shdata.apply();