#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;
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)
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
#include <vector>
#include <msp/core/attributes.h>
-#include "bindable.h"
#include "programdata.h"
namespace Msp {
class ClipPlane;
class Matrix;
-class Clipping: public Bindable<Clipping>
+class Clipping
{
private:
struct AttachedPlane
DEPRECATED void detach(unsigned);
const ProgramData &get_shader_data() const;
-
- void bind() const;
-
- static void unbind();
};
} // namespace GL
glNamedRenderbufferStorage(id, fmt, width, height);
else
{
- BindRestore _bind(this);
+ glBindRenderbuffer(GL_RENDERBUFFER, id);
glRenderbufferStorage(GL_RENDERBUFFER, fmt, width, height);
+ glBindRenderbuffer(GL_RENDERBUFFER, 0);
}
}
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)
#ifndef MSP_GL_RENDERBUFFER_H_
#define MSP_GL_RENDERBUFFER_H_
-#include "bindable.h"
#include "pixelformat.h"
namespace Msp {
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;
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 &);
};