From: Mikko Rasa Date: Fri, 27 Aug 2021 14:17:10 +0000 (+0300) Subject: Remove public binding APIs from Renderbuffer and Clipping X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=94969468a611b0d968021479b60e3f039e348c85 Remove public binding APIs from Renderbuffer and Clipping --- diff --git a/source/core/clipping.cpp b/source/core/clipping.cpp index 644a2434..e7ad643b 100644 --- a/source/core/clipping.cpp +++ b/source/core/clipping.cpp @@ -1,11 +1,9 @@ #include -#include #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::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; iplanes.size(); ++i) - disable(GL_CLIP_PLANE0+i); - } -} - -void Clipping::unbind() -{ - const Clipping *old = current(); - if(!set_current(0)) - return; - - for(unsigned i=0; iplanes.size(); ++i) - disable(GL_CLIP_PLANE0+i); -} - } // namespace GL } // namespace Msp diff --git a/source/core/clipping.h b/source/core/clipping.h index 5600a38b..109aeac9 100644 --- a/source/core/clipping.h +++ b/source/core/clipping.h @@ -3,7 +3,6 @@ #include #include -#include "bindable.h" #include "programdata.h" namespace Msp { @@ -12,7 +11,7 @@ namespace GL { class ClipPlane; class Matrix; -class Clipping: public Bindable +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 diff --git a/source/core/renderbuffer.cpp b/source/core/renderbuffer.cpp index 57b43eba..6851329b 100644 --- a/source/core/renderbuffer.cpp +++ b/source/core/renderbuffer.cpp @@ -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) diff --git a/source/core/renderbuffer.h b/source/core/renderbuffer.h index 4462e31c..84ed3f28 100644 --- a/source/core/renderbuffer.h +++ b/source/core/renderbuffer.h @@ -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 +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 &); };