]> git.tdb.fi Git - libs/gl.git/blobdiff - source/pipeline.cpp
Improve the ambient occlusion algorithm
[libs/gl.git] / source / pipeline.cpp
index f05d15b8271fe0ce9f216b62258f50d10758f231..5294ffbd859d84f4c29ce7878dcd5a01a6fd376b 100644 (file)
@@ -116,15 +116,20 @@ void Pipeline::add_postprocessor(PostProcessor &pp)
        if(!fbo)
        {
                fbo = new Framebuffer;
+
                color_buf = new Texture2D;
                color_buf->set_min_filter(NEAREST);
                color_buf->set_mag_filter(NEAREST);
-               color_buf->storage((hdr ? RGB16F : RGB), width, height, 0);
-               color_buf->image(0, RGB, UNSIGNED_BYTE, 0);
+               color_buf->set_wrap(CLAMP_TO_EDGE);
+               color_buf->storage((hdr ? RGB16F : RGB), width, height);
                fbo->attach(COLOR_ATTACHMENT0, *color_buf, 0);
-               depth_buf = new Renderbuffer;
+
+               depth_buf = new Texture2D;
+               depth_buf->set_min_filter(NEAREST);
+               depth_buf->set_mag_filter(NEAREST);
+               depth_buf->set_wrap(CLAMP_TO_EDGE);
                depth_buf->storage(DEPTH_COMPONENT, width, height);
-               fbo->attach(DEPTH_ATTACHMENT, *depth_buf);
+               fbo->attach(DEPTH_ATTACHMENT, *depth_buf, 0);
        }
 }
 
@@ -172,7 +177,7 @@ void Pipeline::render_all() const
 
        // XXX Need two color buffer textures to handle multiple post-processors correctly
        for(vector<PostProcessor *>::const_iterator i=postproc.begin(); i!=postproc.end(); ++i)
-               (*i)->render(*color_buf);
+               (*i)->render(*color_buf, *depth_buf);
 }