X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fframebuffer.cpp;h=c90bb22469da6b7633ac405d1dc2884d85ef61aa;hb=bec07999d95b76f4b47cffcc564d0cd0afc0435e;hp=cf478ce29b686d842ce2074078952633b2e47b02;hpb=0e130c02d5e89397ac4963676534e0005359c61e;p=libs%2Fgl.git diff --git a/source/framebuffer.cpp b/source/framebuffer.cpp index cf478ce2..c90bb224 100644 --- a/source/framebuffer.cpp +++ b/source/framebuffer.cpp @@ -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); @@ -355,6 +360,9 @@ void Framebuffer::blit_from(const Framebuffer &other, BufferBits bits, bool filt void Framebuffer::bind() const { + if(id && attachments.empty()) + throw invalid_operation("Framebuffer::bind"); + if(set_current(this)) { glBindFramebuffer(GL_FRAMEBUFFER, id);