]> git.tdb.fi Git - libs/gl.git/commitdiff
Add a function to clear all FBO component buffers
authorMikko Rasa <tdb@tdb.fi>
Sun, 9 Feb 2020 22:00:26 +0000 (00:00 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 9 Feb 2020 22:00:26 +0000 (00:00 +0200)
source/environmentmap.cpp
source/framebuffer.cpp
source/framebuffer.h
source/pipeline.cpp
source/view.cpp

index 1cc589143e78da5cc1d47cf456f2f6360613d2ac..bf2a63597cd512244953eba4a7d6ed5dc3248548 100644 (file)
@@ -82,7 +82,7 @@ void EnvironmentMap::setup_frame(Renderer &renderer)
        {
                TextureCubeFace face = TextureCube::enumerate_faces(i);
                fbo[i].bind();
-               fbo[i].clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
+               fbo[i].clear();
                camera.set_look_direction(env_tex.get_face_direction(face));
                camera.set_up_direction(env_tex.get_t_direction(face));
                renderer.set_camera(camera);
index 659b14e7d819c9db635fb2e3469c9403fd0affc6..c90bb22469da6b7633ac405d1dc2884d85ef61aa 100644 (file)
@@ -308,6 +308,11 @@ void Framebuffer::reset_viewport()
        viewport(0, 0, width, height);
 }
 
+void Framebuffer::clear()
+{
+       clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT|STENCIL_BUFFER_BIT);
+}
+
 void Framebuffer::clear(BufferBits bits)
 {
        BindRestore _bind(this);
index f977ad7eb11fdc109740c7a19077ca1e3e7d7ec9..3054bd646b3e4d4709c4ee7ec8a96a5b20bdfa7a 100644 (file)
@@ -138,6 +138,7 @@ public:
        void viewport(int, int, unsigned, unsigned);
        void reset_viewport();
 
+       void clear();
        void clear(BufferBits);
 
        /** Blits a region from another framebuffer into this one.  If the source
index b98ddb8a8d1185c1247522afca359edf80e7d06b..02ccc22ebe80b6ef8fb756facb1516f9c4f0d1d7 100644 (file)
@@ -171,7 +171,7 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const
        {
                Framebuffer &fbo = (samples ? target_ms : target[0])->get_framebuffer();
                fbo.bind();
-               fbo.clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
+               fbo.clear();
        }
 
        for(PassList::const_iterator i=passes.begin(); i!=passes.end(); ++i)
index 19d583ae19b04d1c2eb0f8348b9469255b15d5cf..005904f284b74cbb6c6e9b4343584f882eca70fe 100644 (file)
@@ -40,7 +40,7 @@ void View::render()
 void View::render(Renderer &renderer)
 {
        Bind bind_fbo(target);
-       target.clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
+       target.clear();
        if(content)
        {
                Renderer::Push push(renderer);