Molecular Vis
Improving perception of molecular visualization
FBO.h
1 #pragma once
2 #include <GL/glew.h>
3 #include <vector>
8 class FBO {
9 public:
20  FBO(bool useTextureColor, bool useTextureDepth, bool multiSample, unsigned int width, unsigned int height, bool addSecondColorBuffer = false);
21 
31  FBO(unsigned int nrColorTexture, bool useDepthTexture, bool useMultisampling, unsigned int width, unsigned int height);
32  ~FBO();
33 
41  static void copyFBO(const FBO& from, const FBO& to, unsigned int bufferMask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
45  static void copyFBO(const FBO& from, unsigned int to, unsigned int bufferMask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
49  static void copyFBO(unsigned int from, const FBO& to, unsigned int bufferMask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
50 
58  const unsigned int getColorTexture(unsigned int i) const { return colorTextures.at(i); }
64  const unsigned int getColorTexture() const { return colorTextures.at(0); }
70  const unsigned int getSecondaryColorTexture() const { return colorTextures.at(1); }
77  const unsigned int getDepthTexture() const { return depthTexture; }
82  const bool isMultiSample() const { return multiSample; };
83 
88  void setActive();
89 
94  static unsigned int MULTI_SAMPLE_COUNT;
95 private:
96  unsigned int fbo;
97  unsigned int width;
98  unsigned int height;
99  unsigned int colorTexture; //not needed
100  unsigned int colorTexture2; //not needed
101  unsigned int depthTexture;
102 
103 
104 
105  bool useTextureDepth;
106  bool useTextureColor;
107  std::vector<unsigned int> colorTextures;
108  std::vector<unsigned int> multiSampleTextures;
109  bool hasSecondaryColorBuffer;
110  bool multiSample;
111 
112  void createFrameBuffers(unsigned int nrColorTexture, bool useDepthTexture, bool useMultisampling, unsigned int width, unsigned int height);
113 
114 
115 };
116 
void setActive()
Definition: FBO.cpp:26
const bool isMultiSample() const
Definition: FBO.h:82
const unsigned int getColorTexture(unsigned int i) const
Definition: FBO.h:58
const unsigned int getSecondaryColorTexture() const
Definition: FBO.h:70
static void copyFBO(const FBO &from, const FBO &to, unsigned int bufferMask=GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
Definition: FBO.cpp:114
static unsigned int MULTI_SAMPLE_COUNT
Definition: FBO.h:94
Class for handling render to texture using framebuffer objects.
Definition: FBO.h:8
FBO(bool useTextureColor, bool useTextureDepth, bool multiSample, unsigned int width, unsigned int height, bool addSecondColorBuffer=false)
Definition: FBO.cpp:6
const unsigned int getDepthTexture() const
Definition: FBO.h:77
const unsigned int getColorTexture() const
Definition: FBO.h:64