ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
framebuffer.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef BACKENDS_GRAPHICS3D_OPENGL_FRAMEBUFFER_H
23 #define BACKENDS_GRAPHICS3D_OPENGL_FRAMEBUFFER_H
24 
25 #include "graphics/opengl/system_headers.h"
26 
27 #include "graphics/opengl/texture.h"
28 
29 #if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)
30 
31 namespace OpenGL {
32 
33 class FrameBuffer : public Texture {
34 public:
35  FrameBuffer(uint width, uint height);
36  virtual ~FrameBuffer();
37 
38  virtual void attach();
39  virtual void detach();
40 
41 protected:
42  FrameBuffer(GLenum glIntFormat, GLenum glFormat, GLenum glType, bool autoCreate)
43  : Texture(glIntFormat, glFormat, glType, autoCreate) {}
44 
45  GLuint getFrameBufferName() const { return _frameBuffer; }
46 
47  void init();
48 
49 private:
50  GLuint _renderBuffers[2];
51  GLuint _frameBuffer;
52 };
53 
54 #if !USE_FORCED_GLES2 || defined(USE_GLAD)
55 class MultiSampleFrameBuffer : public FrameBuffer {
56 public:
57  MultiSampleFrameBuffer(uint width, uint height, int samples);
58  virtual ~MultiSampleFrameBuffer();
59 
60  virtual void attach();
61  virtual void detach();
62 
63 private:
64  void init();
65  GLuint _msFrameBufferId;
66  GLuint _msColorId;
67  GLuint _msDepthId;
68  GLuint _msSamples;
69 };
70 #endif
71 
72 } // End of namespace OpenGL
73 
74 #endif // defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)
75 
76 #endif
Definition: renderbuffer.h:27