]> git.tdb.fi Git - libs/gl.git/blob - source/texturing.h
Add an element offset to PrimitiveBuilder
[libs/gl.git] / source / texturing.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2010  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_TEXTURING_H_
9 #define MSP_GL_TEXTURING_H_
10
11 #include <vector>
12 #include "bindable.h"
13
14 namespace Msp {
15 namespace GL {
16
17 class TexEnv;
18 class Texture;
19
20 class Texturing: public Bindable<Texturing>
21 {
22 private:
23         struct Attachment
24         {
25                 const Texture *tex;
26                 const TexEnv *env;
27
28                 Attachment();
29         };
30
31         std::vector<Attachment> attachments;
32
33 public:
34         ~Texturing();
35
36         void attach(unsigned, const Texture &);
37         void attach(unsigned, const Texture &, const TexEnv &);
38         void detach(unsigned);
39 private:
40         void set_attachment(unsigned, const Texture *, const TexEnv *);
41         void bind_attachment(unsigned) const;
42
43         static void unbind_attachment(unsigned);
44
45 public:
46         void bind() const;
47
48         static void unbind();
49 };
50
51 } // namespace GL
52 } // namespace Msp;
53
54 #endif