#ifndef RTS_GLRENDERTOTEXTURE_H #define RTS_GLRENDERTOTEXTURE_H //#include #include #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 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