X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fframeformat.cpp;h=f56d13a68b27db15bd98c9fb97fa5e187bd23fe6;hb=1fba50491957cdd28cff4082a32764691d8ec473;hp=3b114e7f2f0ebd01da02ea39ce5edd72f64e2be8;hpb=0d5406c66549a2cfc2fca701cc1c4972e7fd493a;p=libs%2Fgl.git diff --git a/source/core/frameformat.cpp b/source/core/frameformat.cpp index 3b114e7f..f56d13a6 100644 --- a/source/core/frameformat.cpp +++ b/source/core/frameformat.cpp @@ -133,5 +133,20 @@ GLenum get_gl_attachment(FrameAttachment fa) return GL_COLOR_ATTACHMENT0+get_attach_point(fa); } +GLenum get_gl_buffer_bits(const FrameFormat &format) +{ + GLenum bits = 0; + for(FrameAttachment a: format) + { + if(get_attach_point(a)==get_attach_point(DEPTH_ATTACHMENT)) + bits |= GL_DEPTH_BUFFER_BIT; + else if(get_attach_point(a)==get_attach_point(STENCIL_ATTACHMENT)) + bits |= GL_STENCIL_BUFFER_BIT; + else + bits |= GL_COLOR_BUFFER_BIT; + } + return bits; +} + } // namespace GL } // namespace Msp