goat3dgfx
annotate src/rtarg.h @ 0:1873dfd13f2d
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 14 Nov 2013 05:27:09 +0200 |
parents | |
children | 7d6b667821cf |
rev | line source |
---|---|
nuclear@0 | 1 #ifndef RTARG_H_ |
nuclear@0 | 2 #define RTARG_H_ |
nuclear@0 | 3 |
nuclear@0 | 4 #include "vmath/vmath.h" |
nuclear@0 | 5 #include "opengl.h" |
nuclear@0 | 6 |
nuclear@0 | 7 class Texture; |
nuclear@0 | 8 |
nuclear@0 | 9 class RenderTarget { |
nuclear@0 | 10 private: |
nuclear@0 | 11 int width, height; |
nuclear@0 | 12 |
nuclear@0 | 13 unsigned int fbo; |
nuclear@0 | 14 Texture *color_tex; |
nuclear@0 | 15 unsigned int tex_targ; |
nuclear@0 | 16 int tex_face; |
nuclear@0 | 17 unsigned int rbuf_zstencil; |
nuclear@0 | 18 |
nuclear@0 | 19 public: |
nuclear@0 | 20 RenderTarget(); |
nuclear@0 | 21 ~RenderTarget(); |
nuclear@0 | 22 |
nuclear@0 | 23 bool create(unsigned int fmt = GL_RGBA); |
nuclear@0 | 24 bool create(int width, int height, unsigned int fmt = GL_RGBA); |
nuclear@0 | 25 bool create(Texture *tex, int face = 0); |
nuclear@0 | 26 |
nuclear@0 | 27 void cleanup(); |
nuclear@0 | 28 |
nuclear@0 | 29 bool resize(int width, int height); |
nuclear@0 | 30 |
nuclear@0 | 31 int get_width() const; |
nuclear@0 | 32 int get_height() const; |
nuclear@0 | 33 |
nuclear@0 | 34 Texture *get_texture() const; |
nuclear@0 | 35 |
nuclear@0 | 36 /** calculates a texture matrix to map the full texture space |
nuclear@0 | 37 * onto the part of the texture occupied by the render target |
nuclear@0 | 38 */ |
nuclear@0 | 39 Matrix4x4 get_texture_matrix() const; |
nuclear@0 | 40 |
nuclear@0 | 41 bool check() const; |
nuclear@0 | 42 void bind() const; |
nuclear@0 | 43 }; |
nuclear@0 | 44 |
nuclear@0 | 45 void set_render_target(const RenderTarget *rtarg); |
nuclear@0 | 46 |
nuclear@0 | 47 int next_pow2(int x); |
nuclear@0 | 48 |
nuclear@0 | 49 #endif // RTARG_H_ |