1#ifndef TATOOINE_GL_FRAMEBUFFER_H
2#define TATOOINE_GL_FRAMEBUFFER_H
14 template <
typename... Textures>
16 constexpr auto num_color_attachements =
21 (void)std::array{(texture_depth_component<typename Textures::components>
23 :
attach(textures, i++))...};
26 std::array<GLenum, num_color_attachements> colbufs;
27 auto add_attachement = [j = 0, &colbufs](
const auto& tex)
mutable {
28 using TA =
decltype(tex);
29 using Texture =
typename std::decay_t<TA>;
30 using Components =
typename Texture::components;
31 if constexpr (texture_color_component<Components>) {
32 colbufs[j] = GL_COLOR_ATTACHMENT0 + j;
33 return GL_COLOR_ATTACHMENT0 + j++;
37 (void)std::array{add_attachement(textures)...};
41 template <
typename T,
typename Components>
60 template <
typename... Cs>
62 return sum((texture_color_component<Cs> ? 1 : 0)...);
65 template <
typename... Ts>
66 static constexpr auto sum(Ts... ts) {
Definition: framebuffer.h:10
static constexpr auto sum(Ts... ts)
Definition: framebuffer.h:66
DLL_API GLenum attach(const tex2< T, Components > &tex, unsigned int i=0)
DLL_API framebuffer(const Textures &... textures)
Definition: framebuffer.h:15
static DLL_API void unbind()
static constexpr auto num_color_components()
Definition: framebuffer.h:61
constexpr GLenum attach(const tex2< T, Depth > &depth_tex, unsigned int)
Definition: framebuffer.h:48
DLL_API GLenum attach(const tex2< T, Depth > &depth_tex)
Definition: ansiformat.h:6
DLL_API auto named_framebuffer_draw_buffers(GLuint framebuffer, GLsizei n, const GLenum *bufs) -> void
Definition: idholder.h:31