goat3dgfx

view src/rtarg.h @ 15:7d6b667821cf

wrapped everything in the goatgfx namespace
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 30 Nov 2013 20:52:21 +0200
parents 1873dfd13f2d
children
line source
1 #ifndef RTARG_H_
2 #define RTARG_H_
4 #include "vmath/vmath.h"
5 #include "opengl.h"
7 namespace goatgfx {
9 class Texture;
11 class RenderTarget {
12 private:
13 int width, height;
15 unsigned int fbo;
16 Texture *color_tex;
17 unsigned int tex_targ;
18 int tex_face;
19 unsigned int rbuf_zstencil;
21 public:
22 RenderTarget();
23 ~RenderTarget();
25 bool create(unsigned int fmt = GL_RGBA);
26 bool create(int width, int height, unsigned int fmt = GL_RGBA);
27 bool create(Texture *tex, int face = 0);
29 void cleanup();
31 bool resize(int width, int height);
33 int get_width() const;
34 int get_height() const;
36 Texture *get_texture() const;
38 /** calculates a texture matrix to map the full texture space
39 * onto the part of the texture occupied by the render target
40 */
41 Matrix4x4 get_texture_matrix() const;
43 bool check() const;
44 void bind() const;
45 };
47 void set_render_target(const RenderTarget *rtarg);
49 int next_pow2(int x);
51 } // namespace goatgfx
53 #endif // RTARG_H_