X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Frenderbuffer.cpp;h=5bea07fc81e60a70c26c7744f3e7d5a6434bc621;hp=9d19e08b814c7b6976236e61ba2bb32c36f59e6c;hb=c5f011ef508d580f332e4bd6065a013b24de8840;hpb=03de23d42e418f5d7d86c1fbe8665aef1f0a36bd diff --git a/source/renderbuffer.cpp b/source/renderbuffer.cpp index 9d19e08b..5bea07fc 100644 --- a/source/renderbuffer.cpp +++ b/source/renderbuffer.cpp @@ -1,8 +1,11 @@ #include #include #include +#include "misc.h" #include "renderbuffer.h" +using namespace std; + namespace Msp { namespace GL { @@ -44,9 +47,21 @@ void Renderbuffer::storage(PixelFormat fmt, unsigned wd, unsigned ht) } } +unsigned Renderbuffer::get_max_samples() +{ + static unsigned max_samples = (EXT_framebuffer_multisample ? get_i(GL_MAX_SAMPLES) : 0); + return max_samples; +} + void Renderbuffer::storage_multisample(unsigned samples, PixelFormat fmt, unsigned wd, unsigned ht) { + if(!samples) + return storage(fmt, wd, ht); + static Require _req(EXT_framebuffer_multisample); + if(samples>get_max_samples()) + throw out_of_range("Renderbuffer::storage_multisample"); + fmt = normalize_format(fmt); require_pixelformat(fmt);