20#ifndef HEADER_FRAME_BUFFER_LAYER_HPP
21#define HEADER_FRAME_BUFFER_LAYER_HPP
23#include "graphics/frame_buffer.hpp"
28 std::vector<GLuint> m_fbo_layer;
34 unsigned layer_count);
37 unsigned w,
unsigned h,
unsigned layer_count);
41 if (!m_fbo_layer.empty())
43 glDeleteFramebuffers((
int)m_fbo_layer.size(), m_fbo_layer.data());
47 void bindLayer(
unsigned i)
const
49 assert(i < m_fbo_layer.size());
50 glBindFramebuffer(GL_FRAMEBUFFER, m_fbo_layer[i]);
51 glViewport(0, 0, (
int)m_width, (
int)m_height);
52 GLenum bufs[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1,
53 GL_COLOR_ATTACHMENT2 };
54 glDrawBuffers((
int)m_render_targets.size(), bufs);
57 void bindLayerDepthOnly(
unsigned i)
const
59 assert(i < m_fbo_layer.size());
60 glBindFramebuffer(GL_FRAMEBUFFER, m_fbo_layer[i]);
61 glViewport(0, 0, (
int)m_width, (
int)m_height);
62 GLenum bufs[] = { GL_NONE, GL_NONE, GL_NONE };
63 glDrawBuffers((
int)m_render_targets.size(), bufs);
66 unsigned getLayerCount()
const {
return (
unsigned)m_fbo_layer.size(); }
Definition: frame_buffer_layer.hpp:26
Definition: frame_buffer.hpp:33