X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fambientocclusion.cpp;h=cb4bc9d29ff381685e37c713aa8fd9d2200942b9;hb=8ec12629c4808588b0eaef88147e22fa658ac990;hp=53b51e127d0993ce8e15093d1d1b1dc25c59c192;hpb=d1e3975c163694d7bca6417463462be950019e5e;p=libs%2Fgl.git diff --git a/source/ambientocclusion.cpp b/source/ambientocclusion.cpp index 53b51e12..cb4bc9d2 100644 --- a/source/ambientocclusion.cpp +++ b/source/ambientocclusion.cpp @@ -10,18 +10,12 @@ namespace Msp { namespace GL { AmbientOcclusion::AmbientOcclusion(unsigned w, unsigned h, float depth_ratio): + occlude_target(w, h, (RENDER_COLOR,RGB)), occlude_shader("ambientocclusion_occlude.glsl"), combine_shader("ambientocclusion_combine.glsl"), quad(get_fullscreen_quad()) { - 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); + combine_texturing.attach(2, occlude_target.get_target_texture(RENDER_COLOR)); rotate_lookup.storage(RGBA, 4, 4); rotate_lookup.set_min_filter(NEAREST); @@ -73,10 +67,9 @@ void AmbientOcclusion::render(Renderer &renderer, const Texture2D &color, const combine_texturing.attach(0, depth); combine_texturing.attach(1, color); - { Renderer::Push push(renderer); - BindRestore bind_fbo(fbo); + BindRestore bind_fbo(occlude_target.get_framebuffer()); renderer.set_texturing(&occlude_texturing); renderer.set_shader_program(&occlude_shader, &occlude_shdata); quad.draw(renderer);