X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Frtarg.h;h=22abc4fbe88e86bceb55a8db65bd7d283203b330;hp=2cead1121299c5df047504716bf67dcb30aafb93;hb=2829b50d6b3d9e97fc9399f5b6929f7d64021366;hpb=197bafc7f54795243d4c217c2efcf41f01d4100d diff --git a/src/rtarg.h b/src/rtarg.h index 2cead11..22abc4f 100644 --- a/src/rtarg.h +++ b/src/rtarg.h @@ -12,6 +12,14 @@ enum { RT_STENCIL = 4 }; +// flags for push_render_target/pop_render_target and RenderTarget::bind +enum { + RT_NO_VPORT = 1, + RT_NO_BIND = 2, + + RT_FAKE = RT_NO_VPORT | RT_NO_BIND +}; + class RenderTarget { private: int width, height; @@ -25,6 +33,7 @@ private: unsigned int rbdepth, rbdepth_fmt; Mat4 texmat; // texture matrix to map tex coords from [0,1] to the useful area + bool own_fbo; bool own_texture[4]; bool auto_vport; @@ -36,6 +45,13 @@ public: unsigned int flags = RT_COLOR | RT_DEPTH); bool create_mrt(int xsz, int ysz, int num, unsigned int fmt = GL_RGB16F, unsigned int flags = RT_COLOR | RT_DEPTH); + /* create a RenderTarget wrapping an existing FBO. + * At this point this is just a hack with limited functionality. + * Calls which return textures might return 0. get_width/get_height + * will return whatever is passed here as xsz/ysz. resize will not do + * anything. + */ + bool create_wrap_fbo(unsigned int fbo, int xsz, int ysz); void destroy(); bool resize(int xsz, int ysz); @@ -52,14 +68,14 @@ public: void set_auto_viewport(bool enable); bool auto_viewport() const; - void bind() const; + void bind(unsigned int flags = 0) const; const Mat4 &texture_matrix() const; }; void set_render_target(RenderTarget *rt); RenderTarget *current_render_target(); -bool push_render_target(RenderTarget *rt); -bool pop_render_target(); +bool push_render_target(RenderTarget *rt, unsigned int flags = 0); +bool pop_render_target(unsigned int flags = 0); #endif // RTARG_H_