Kinetic Visualization
 All Classes Functions Variables Pages
FBO.h
1 #pragma once
2 #include "common.hpp"
3 #include "Texture.h"
4 #include "GL/glew.h"
5 #include <vector>
6 
7 class FBO : public Texture
8 {
9 public:
10  typedef boost::shared_ptr<FBO> FBOPtr;
11 
15  FBO();
28  FBO(int width, int height, bool bingbong=false, unsigned int internal_format=GL_RGBA32F, unsigned int format=GL_RGBA, unsigned int interpolation_min=GL_LINEAR, unsigned int interpolation_max=GL_LINEAR, int type=0, unsigned int num_texture = 1, bool helper = false);
39  FBO(int width, int height, int depth, bool bingbong=false, unsigned int internal_format=GL_RGBA32F, unsigned int format=GL_RGBA, unsigned int interpolation_min=GL_LINEAR, unsigned int interpolation_max=GL_LINEAR, int type=0);
43  ~FBO(void);
44 
48  void CheckFBO(GLenum FBOstatus)
49  {
50  if(FBOstatus == GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT) printf("Incomplete attachment\n");
51  if(FBOstatus == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT) printf("Missing attachment\n");
52  if(FBOstatus == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT) printf("Incomplete dimensions\n");
53  if(FBOstatus == GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER) printf("Incomplete read buffer\n");
54  if(FBOstatus == GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER) printf("GL_FRAMEBUFFER_COMPLETE für Blur Effekt konnte ned benutzt werden\n");
55  if(FBOstatus == GL_FRAMEBUFFER_UNSUPPORTED) printf("Framebufferobjects unsupported\n");
56  };
57 
58 private:
59  void CreateFBO(GLuint& depth, GLuint& texn, GLuint& fbo);
60  void Create3DFBO(GLuint& texn, GLuint& fbo);
61 
62 public:
66  void Bind();
71  void Bind(int z);
76  void BindTexture(int z);
77 
81  void Unbind();
85  void BindColorAttachementAtTextureAndEnable(unsigned int i);
86  /*
87  * Draw Buffers
88  */
89  void DrawBuffers();
94  int GetWidth();
99  int GetHeight();
104  int GetDepth();
105 
106  GLuint fbo1;
107  GLuint fbo2;
108  GLuint depthbuffer2;
109  GLuint depthbuffer1;
110  std::vector<GLenum> buffers;
111  int g_iWidth;
112  int g_iHeight;
113  int g_iDepth;
114 
115  unsigned int m_format;
116  unsigned int m_internal_format;
117  unsigned int m_interpolation_min;
118  unsigned int m_interpolation_max;
119  int m_type;
120 
121 
122  unsigned int m_num_texture;
123  std::vector<Texture::TexturePtr> multi_outputs;
124 };
125