X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fframebuffer.cpp;h=1dd2f61f9bab10139772b8619075370df41b2849;hp=ffd92a22f8329e05b2c604802d05467a3065f555;hb=ad574f042d59513eec36af64c38aaf9abe6deed2;hpb=fc55a95ad69fbaaefde3071712bf36a470970bc0 diff --git a/source/core/framebuffer.cpp b/source/core/framebuffer.cpp index ffd92a22..1dd2f61f 100644 --- a/source/core/framebuffer.cpp +++ b/source/core/framebuffer.cpp @@ -1,5 +1,7 @@ #include #include +#include +#include #include #include #include @@ -83,6 +85,19 @@ void Framebuffer::set_format(const FrameFormat &fmt) if(fmt.empty()) throw invalid_argument("Framebuffer::set_format"); + if(ARB_internalformat_query && ARB_internalformat_query2) + { + unsigned target = (fmt.get_samples()>1 ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D); + for(FrameAttachment a: fmt) + { + unsigned pf = get_gl_pixelformat(get_attachment_pixelformat(a)); + int supported = 0; + glGetInternalformativ(target, pf, GL_FRAMEBUFFER_RENDERABLE, 1, &supported); + if(supported!=GL_FULL_SUPPORT) + throw invalid_argument("Framebuffer::set_format"); + } + } + format = fmt; attachments.resize(format.size()); }