]> git.tdb.fi Git - libs/gl.git/blob - source/texturing.h
Change Texturing to store index-texture pairs
[libs/gl.git] / source / texturing.h
1 #ifndef MSP_GL_TEXTURING_H_
2 #define MSP_GL_TEXTURING_H_
3
4 #include <vector>
5 #include "bindable.h"
6
7 namespace Msp {
8 namespace GL {
9
10 class Texture;
11
12 class Texturing: public Bindable<Texturing>
13 {
14 private:
15         struct Attachment
16         {
17                 unsigned unit;
18                 const Texture *texture;
19
20                 Attachment(unsigned, const Texture *);
21         };
22
23         std::vector<Attachment> attachments;
24
25 public:
26         ~Texturing();
27
28         void attach(unsigned, const Texture &);
29         void detach(unsigned);
30 private:
31         void set_attachment(unsigned, const Texture *);
32 public:
33         const Texture *get_attached_texture(unsigned) const;
34
35         void bind() const;
36
37         static void unbind();
38 };
39
40 } // namespace GL
41 } // namespace Msp;
42
43 #endif