OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
framebuffer.h
1 /*
2  Copyright (C) 2014 - 2016 Mutzii
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
18 #ifndef FRAMEBUFFER_H
19 #define FRAMEBUFFER_H
20 
21 #include "index.h"
22 #include "texturemanager.h"
23 
24 namespace Engine
25 {
26  using FBOTextureMap = std::map< GLenum , Texture * >;
27 
32  {
33  public:
34 
35  // Texture Array Attachments
36  enum
37  {
38  FB_TEXTURE_ARRAY0 ,
39  FB_TEXTURE_ARRAY1 ,
40  FB_TEXTURE_ARRAY2 ,
41  FB_TEXTURE_ARRAY3 ,
42  FB_TEXTURE_ARRAY4 ,
43  FB_TEXTURE_ARRAY5 ,
44  FB_TEXTURE_ARRAY6 ,
45  FB_TEXTURE_ARRAY7 ,
46  FB_TEXTURE_ARRAY8 ,
47  FB_TEXTURE_ARRAY9 ,
48  FB_TEXTURE_ARRAY10 ,
49  FB_TEXTURE_ARRAY11 ,
50  FB_TEXTURE_ARRAY12 ,
51  FB_TEXTURE_ARRAY13 ,
52  FB_TEXTURE_ARRAY14 ,
53  FB_TEXTURE_ARRAY15
54  };
55 
56 
57  explicit FrameBuffer( int width , int height );
58  ~FrameBuffer();
59 
64  void ReadFrameBuffer(void);
65 
70  void DrawFrameBuffer(void);
71 
76  void BindFrameBuffer(void);
77 
81  void Unbind();
82 
91  void BindTextureArray( Texture * texture , GLenum attachment );
92  void AddTexture( Texture * texture , GLenum attachment );
93 
94 
105  void BindTextureLayer(Texture * texture , int layer , GLenum attachment );
106 
118  void BindTexture( Texture * texture , GLenum attachment );
119 
120 
134  void BindRenderBuffer( Texture * texture , GLenum attachment );
135 
142  Texture * getRenderBuffer( GLenum attachment );
143 
150  Texture * getTexture( GLenum attachment );
151 
157  int getFrameWidth(void);
158 
164  int getFrameHeight(void);
165 
166  private:
167 
168  uint mId;
170  int mWidth;
171  int mHeight;
173  FBOTextureMap mRenderBufferMap;
174  FBOTextureMap mTextureMap;
175  };
176 }
177 
178 #endif // FRAMEBUFFER_H
The Texture class.
Definition: texture.h:37
void BindTextureLayer(Texture *texture, int layer, GLenum attachment)
FrameBuffer::BindTextureLayer.
Definition: FrameBuffer.cpp:150
Texture * getTexture(GLenum attachment)
getTexture
Definition: FrameBuffer.cpp:69
void BindFrameBuffer(void)
BindFrameBuffer.
Definition: FrameBuffer.cpp:42
void BindTextureArray(Texture *texture, GLenum attachment)
FrameBuffer::BindTextureArray.
Definition: FrameBuffer.cpp:129
Definition: element.h:23
int getFrameWidth(void)
getFrameWidth
Definition: FrameBuffer.cpp:76
void BindTexture(Texture *texture, GLenum attachment)
FrameBuffer::BindTexture.
Definition: FrameBuffer.cpp:99
void DrawFrameBuffer(void)
DrawFrameBuffer.
Definition: FrameBuffer.cpp:52
void BindRenderBuffer(Texture *texture, GLenum attachment)
FrameBuffer::BindRenderBuffer.
Definition: FrameBuffer.cpp:175
void ReadFrameBuffer(void)
ReadFrameBuffer.
Definition: FrameBuffer.cpp:47
Texture * getRenderBuffer(GLenum attachment)
getRenderBuffer
Definition: FrameBuffer.cpp:63
The FrameBuffer class.
Definition: framebuffer.h:31
void Unbind()
Unbind.
Definition: FrameBuffer.cpp:57
int getFrameHeight(void)
getFrameHeight
Definition: FrameBuffer.cpp:81