Cutout Vis2012
TUWienVisualisierung2(SS2012)-AdaptiveCutaways
 All Classes Namespaces Functions Pages
Framebuffer.h
1 #ifndef _FRAMEBUFFER_H_
2 #define _FRAMEBUFFER_H_
3 
4 #include "include_opengl.h"
5 
11 {
12 public:
13  FramebufferDescriptor(int width, int height);
14 
15  int width, height;
16  int depthFormat, depthInternalFormat;
17  int numColorAttachments;
18  int* colorFormat;
19  int* colorInternalFormat;
20 
21  GLint textureWrap;
22 
23  GLint depthMinFilter, depthMagFilter;
24  GLint depthType;
25 
26  GLint colorMinFilter, colorMagFilter;
27  GLenum colorType;
28 };
29 
34 {
35 public:
36  Framebuffer();
40  ~Framebuffer();
41 
45  bool init(const FramebufferDescriptor& descriptor);
46 
50  bool init(int width, int height, int depthFormat, int depthInternalFormat,
51  int numColorAttachments, int* colorFormat, int* colorInternalFormat);
52 
53  bool init(int width, int height, int depthFormat, int depthInternalFormat,
54  int colorFormat, int colorInternalFormat);
55 
59  void bind() const;
63  void unbind() const;
64 
68  GLuint getDepthTextureHandle() const;
72  GLuint getColorTextureHandle(int i=0) const;
76  GLuint getHandle() const;
80  void setViewport() const;
81 
82  int getWidth() const;
83  int getHeight() const;
84 
85 private:
86  GLuint _framebufferHandle;
87 
88  int _depthFormat, _depthInternalFormat;
89  GLuint _depthTextureHandle;
90 
91  int _numColorAttachments;
92  int *_colorFormat, *_colorInternalFormat;
93  GLuint *_colorTextureHandle;
94  GLenum* _colorAttachments;
95 
96  int _width, _height;
97  bool _initted;
98 };
99 
100 
101 #endif