]> git.tdb.fi Git - libs/gl.git/blob - source/backends/opengl/frameformat_backend.cpp
Check the flat qualifier from the correct member
[libs/gl.git] / source / backends / opengl / frameformat_backend.cpp
1 #include <msp/gl/extensions/ext_framebuffer_object.h>
2 #include "frameformat.h"
3 #include "frameformat_backend.h"
4 #include "gl.h"
5
6 namespace Msp {
7 namespace GL {
8
9 unsigned get_gl_attachment(FrameAttachment fa)
10 {
11         if(get_attach_point(fa)==get_attach_point(DEPTH_ATTACHMENT))
12                 return GL_DEPTH_ATTACHMENT;
13         else if(get_attach_point(fa)==get_attach_point(STENCIL_ATTACHMENT))
14                 return GL_STENCIL_ATTACHMENT;
15         else
16                 return GL_COLOR_ATTACHMENT0+get_attach_point(fa);
17 }
18
19 unsigned get_gl_buffer_bits(const FrameFormat &format)
20 {
21         unsigned bits = 0;
22         for(FrameAttachment a: format)
23         {
24                 if(get_attach_point(a)==get_attach_point(DEPTH_ATTACHMENT))
25                         bits |= GL_DEPTH_BUFFER_BIT;
26                 else if(get_attach_point(a)==get_attach_point(STENCIL_ATTACHMENT))
27                         bits |= GL_STENCIL_BUFFER_BIT;
28                 else
29                         bits |= GL_COLOR_BUFFER_BIT;
30         }
31         return bits;
32 }
33
34 } // namespace GL
35 } // namespace Msp