2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
#ifndef GL_RENDER_TO_TEXTURE_H
|
|
|
|
#define GL_RENDER_TO_TEXTURE_H
|
|
|
|
|
|
|
|
///See http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/
|
|
|
|
#include "OpenGLInclude.h"
|
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
enum
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
2018-09-23 21:17:31 +00:00
|
|
|
RENDERTEXTURE_COLOR = 1,
|
2015-04-16 16:55:32 +00:00
|
|
|
RENDERTEXTURE_DEPTH,
|
|
|
|
};
|
|
|
|
struct GLRenderToTexture
|
|
|
|
{
|
|
|
|
GLuint m_framebufferName;
|
2018-09-23 21:17:31 +00:00
|
|
|
GLuint m_depthrenderbuffer;
|
|
|
|
bool m_initialized;
|
|
|
|
int m_renderTextureType;
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
public:
|
|
|
|
GLRenderToTexture();
|
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
void init(int width, int height, GLuint textureId, int renderTextureType = RENDERTEXTURE_COLOR);
|
|
|
|
bool enable();
|
|
|
|
void disable();
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual ~GLRenderToTexture();
|
|
|
|
};
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
#endif //GL_RENDER_TO_TEXTURE_H
|