]> git.tdb.fi Git - libs/gl.git/commitdiff
Remove public binding APIs from Renderbuffer and Clipping
authorMikko Rasa <tdb@tdb.fi>
Fri, 27 Aug 2021 14:17:10 +0000 (17:17 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 27 Aug 2021 23:55:59 +0000 (02:55 +0300)
source/core/clipping.cpp
source/core/clipping.h
source/core/renderbuffer.cpp
source/core/renderbuffer.h

index 644a2434c6b783bda0f806012f23e841e9acd5b8..e7ad643bdbbd0dadcb908f78f63cf2f0c237528a 100644 (file)
@@ -1,11 +1,9 @@
 #include <msp/core/algorithm.h>
-#include <msp/gl/extensions/msp_clipping.h>
 #include "clipping.h"
 #include "clipplane.h"
 #include "deviceinfo.h"
 #include "error.h"
 #include "matrix.h"
-#include "misc.h"
 
 using namespace std;
 
@@ -25,20 +23,13 @@ void Clipping::attach(const ClipPlane &p)
                throw invalid_operation("Clipping::attach");
 
        planes.push_back(&p);
-       if(current()==this)
-               glEnable(GL_CLIP_PLANE0+planes.size()-1);
 }
 
 void Clipping::detach(const ClipPlane &p)
 {
        vector<AttachedPlane>::iterator i = find_member(planes, &p, &AttachedPlane::plane);
        if(i!=planes.end())
-       {
                planes.erase(i);
-               if(current()==this)
-                       disable(GL_CLIP_PLANE0+planes.size());
-
-       }
 }
 
 void Clipping::detach(unsigned i)
@@ -59,33 +50,5 @@ const ProgramData &Clipping::get_shader_data() const
        return shdata;
 }
 
-void Clipping::bind() const
-{
-       static Require _req(MSP_clipping);
-
-       const Clipping *old = current();
-       if(!set_current(this))
-               return;
-
-       for(unsigned i=0; i<planes.size(); ++i)
-               enable(GL_CLIP_PLANE0+i);
-
-       if(old)
-       {
-               for(unsigned i=planes.size(); i<old->planes.size(); ++i)
-                       disable(GL_CLIP_PLANE0+i);
-       }
-}
-
-void Clipping::unbind()
-{
-       const Clipping *old = current();
-       if(!set_current(0))
-               return;
-
-       for(unsigned i=0; i<old->planes.size(); ++i)
-               disable(GL_CLIP_PLANE0+i);
-}
-
 } // namespace GL
 } // namespace Msp
index 5600a38ba9d70f9ef4a96c89b315a22ea485f1f1..109aeac99d2cea9561d09f46095bb09a9ce8ab2a 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <vector>
 #include <msp/core/attributes.h>
-#include "bindable.h"
 #include "programdata.h"
 
 namespace Msp {
@@ -12,7 +11,7 @@ namespace GL {
 class ClipPlane;
 class Matrix;
 
-class Clipping: public Bindable<Clipping>
+class Clipping
 {
 private:
        struct AttachedPlane
@@ -38,10 +37,6 @@ public:
        DEPRECATED void detach(unsigned);
 
        const ProgramData &get_shader_data() const;
-
-       void bind() const;
-
-       static void unbind();
 };
 
 } // namespace GL
index 57b43eba7aaf6dcabc8b8899efff8310e66c11ac..6851329bc347140400a366b06e803f38f7ae58b3 100644 (file)
@@ -34,8 +34,9 @@ void Renderbuffer::storage(PixelFormat fmt, unsigned wd, unsigned ht)
                glNamedRenderbufferStorage(id, fmt, width, height);
        else
        {
-               BindRestore _bind(this);
+               glBindRenderbuffer(GL_RENDERBUFFER, id);
                glRenderbufferStorage(GL_RENDERBUFFER, fmt, width, height);
+               glBindRenderbuffer(GL_RENDERBUFFER, 0);
        }
 }
 
@@ -61,21 +62,10 @@ void Renderbuffer::storage_multisample(unsigned samples, PixelFormat fmt, unsign
                glNamedRenderbufferStorageMultisample(id, samples, fmt, width, height);
        else
        {
-               BindRestore _bind(this);
-               glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, fmt, width, height);
-       }
-}
-
-void Renderbuffer::bind() const
-{
-       if(set_current(this))
                glBindRenderbuffer(GL_RENDERBUFFER, id);
-}
-
-void Renderbuffer::unbind()
-{
-       if(set_current(0))
+               glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, fmt, width, height);
                glBindRenderbuffer(GL_RENDERBUFFER, 0);
+       }
 }
 
 void Renderbuffer::set_debug_name(const string &name)
index 4462e31c12ce348ecb381eb546e98637cb75ebd6..84ed3f28415fa95becfc47152e9a9344b479765f 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef MSP_GL_RENDERBUFFER_H_
 #define MSP_GL_RENDERBUFFER_H_
 
-#include "bindable.h"
 #include "pixelformat.h"
 
 namespace Msp {
@@ -16,7 +15,7 @@ provide a capability for multisampling, which is not available in textures.
 Requires the GL_EXT_framebuffer_object extension.  Multisample renderbuffers
 additionally require the GL_EXT_framebuffer_multisample extension.
 */
-class Renderbuffer: public Bindable<Renderbuffer>
+class Renderbuffer
 {
 private:
        unsigned id;
@@ -44,10 +43,6 @@ public:
        functions.*/
        void storage_multisample(unsigned samples, PixelFormat fmt, unsigned wd, unsigned ht);
 
-       void bind() const;
-
-       static void unbind();
-
        void set_debug_name(const std::string &);
 };