]> git.tdb.fi Git - libs/gl.git/blob - source/render/rendertarget.h
Move WindowView::render to the backend
[libs/gl.git] / source / render / rendertarget.h
1 #ifndef RENDERTARGET_H_
2 #define RENDERTARGET_H_
3
4 #include "framebuffer.h"
5
6 namespace Msp {
7 namespace GL {
8
9 class Texture;
10 class Texture2D;
11
12 /**
13 Wraps a Framebuffer and its attachments for easier management.
14
15 All attachments will be created as 2D or 2D multisample textures, depending on
16 the sample count of the format.
17 */
18 class RenderTarget
19 {
20 private:
21         unsigned width;
22         unsigned height;
23         std::vector<Texture *> textures;
24         Framebuffer fbo;
25
26 public:
27         RenderTarget(unsigned, unsigned, const FrameFormat & = (COLOR_ATTACHMENT, DEPTH_ATTACHMENT));
28 private:
29         RenderTarget(const RenderTarget &);
30         RenderTarget &operator=(const RenderTarget &);
31 public:
32         ~RenderTarget();
33
34         unsigned get_width() const { return width; }
35         unsigned get_height() const { return height; }
36         const FrameFormat &get_format() const { return fbo.get_format(); }
37         Framebuffer &get_framebuffer() { return fbo; }
38         const Texture2D &get_target_texture(unsigned) const;
39         const Texture2D &get_target_texture(FrameAttachment) const;
40
41         void set_debug_name(const std::string &);
42 };
43
44 } // namespace GL
45 } // namespace Msp
46
47 #endif