Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
framebuffer.h
1 #pragma once
2 
3 #include <vector>
4 
5 #include <glm/glm.hpp>
6 
7 #include <glow/ref_ptr.h>
8 
9 #include "etc/contextdependant.h"
10 
11 
12 namespace glow {
13  class FrameBufferObject;
14  class Texture;
15 }
16 
17 class FrameBuffer : public ContextDependant {
18 public:
19  FrameBuffer(int colorAttachments = 1, bool depthAttachment = true);
20 
21  void bind();
22  void unbind();
23 
24  void clear();
25 
26  glow::FrameBufferObject& get();
27  void setDrawBuffers(const std::vector<int>& buffers);
28 
29  void setResolution(const glm::ivec2& resolution);
30  const glm::ivec2& resolution();
31 
32  glow::Texture* texture(int i);
33 
34 
35 protected:
36  int m_colorAttachmentCount;
37  bool m_useDepthAttachment;
38  glm::ivec2 m_resolution;
39  glow::ref_ptr<glow::FrameBufferObject> m_fbo;
40 
41  void setupFBO();
42  virtual void beforeContextDestroy() override;
43  virtual void afterContextRebuild() override;
44 };
Definition: contextdependant.h:7
Definition: framebuffer.h:17