Moronic bug identified, also Backtrace is a thing now
[ipdf/code.git] / src / framebuffer.h
1 #ifndef _FRAMEBUFFER_H
2 #define _FRAMEBUFFER_H
3
4 #include <SDL.h>
5 #include "gl_core44.h"
6
7
8 namespace IPDF
9 {
10         /**
11          * The "FrameBuffer" class represents an offscreen render target. 
12          * FrameBuffer::Create needs to be called to initialise it; constructor is trivial
13          */
14         class FrameBuffer
15         {
16         public:
17                 FrameBuffer() : m_render_texture(0), m_render_fbo(0), m_width(0), m_height(0) {}
18                 ~FrameBuffer() { Destroy(); }
19                 void Create(int w, int h);
20                 void Destroy();
21                 void Bind(); // set as render target
22                 void UnBind(); // set render target to screen
23                 void Blit(); // blit this FrameBuffer to current render target
24                 void Clear(float r=1.0, float g=1.0, float b=1.0, float a=1.0);
25                 int GetWidth() { return m_width; }
26                 int GetHeight() { return m_height; }
27         private:
28                 GLuint m_render_texture;
29                 GLuint m_render_fbo;
30                 int m_width;
31                 int m_height;
32         };
33
34 }
35
36 #endif // _SCREEN_H

UCC git Repository :: git.ucc.asn.au