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;
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;
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);
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_