f1402849
dmayerich
renewed commit
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#ifndef RTS_GLRENDERTOTEXTURE_H
#define RTS_GLRENDERTOTEXTURE_H
//#include <gl/gl.h>
#include <vector>
#include "rts_glTextureMap.h"
using namespace std;
class rts_glRenderToTexture
{
private:
bool init;
GLuint fbo; //framebuffer object
int width; //width and height of the framebuffer
int height;
vector<rts_glTextureMap> textures;
public:
//constructors
rts_glRenderToTexture(){init = false; fbo = 0;}
rts_glRenderToTexture(int width, int height){Init(width, height);}
void Init(int width, int height); //initialization
void Clean();
void AddTexture(GLenum target,
GLint internalformat = 1,
GLenum format = GL_LUMINANCE,
GLenum datatype = GL_UNSIGNED_BYTE,
GLint interpolation = GL_NEAREST);
void BeginTexture(int texture){textures[texture].BeginTexture();}
void EndTexture(int texture){textures[texture].EndTexture();}
rts_glTextureMap GetTexture(int texture){return textures[texture];}
void BeginRender(int texture);
void EndRender();
int Width(){return width;}
int Height(){return height;}
void UseMaxViewport(){glViewport(0, 0, width, height);}
};
#endif
|