goat3dgfx

view src/rtarg.h @ 3:eb75bff21824

added convenience header file which includes everything else
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 16 Nov 2013 21:09:16 +0200
parents
children 7d6b667821cf
line source
1 #ifndef RTARG_H_
2 #define RTARG_H_
4 #include "vmath/vmath.h"
5 #include "opengl.h"
7 class Texture;
9 class RenderTarget {
10 private:
11 int width, height;
13 unsigned int fbo;
14 Texture *color_tex;
15 unsigned int tex_targ;
16 int tex_face;
17 unsigned int rbuf_zstencil;
19 public:
20 RenderTarget();
21 ~RenderTarget();
23 bool create(unsigned int fmt = GL_RGBA);
24 bool create(int width, int height, unsigned int fmt = GL_RGBA);
25 bool create(Texture *tex, int face = 0);
27 void cleanup();
29 bool resize(int width, int height);
31 int get_width() const;
32 int get_height() const;
34 Texture *get_texture() const;
36 /** calculates a texture matrix to map the full texture space
37 * onto the part of the texture occupied by the render target
38 */
39 Matrix4x4 get_texture_matrix() const;
41 bool check() const;
42 void bind() const;
43 };
45 void set_render_target(const RenderTarget *rtarg);
47 int next_pow2(int x);
49 #endif // RTARG_H_