]> git.tdb.fi Git - libs/gl.git/blob - source/backends/opengl/texture_backend.h
815778203bcaba66f4e13de3f81a2b08aa8450a0
[libs/gl.git] / source / backends / opengl / texture_backend.h
1 #ifndef MSP_GL_TEXTURE_BACKEND_H_
2 #define MSP_GL_TEXTURE_BACKEND_H_
3
4 #include <msp/core/noncopyable.h>
5
6 namespace Msp {
7 namespace GL {
8
9 class OpenGLTexture: public NonCopyable
10 {
11         friend class OpenGLFramebuffer;
12         friend class OpenGLPipelineState;
13
14 protected:
15         unsigned id;
16         unsigned target;
17         std::string debug_name;
18
19         static int swizzle_orders[];
20         static OpenGLTexture *scratch_binding;
21
22         OpenGLTexture(unsigned);
23         ~OpenGLTexture();
24
25         void create();
26         void require_swizzle();
27         void apply_swizzle();
28         void set_parameter_i(unsigned, int) const;
29
30         void generate_mipmap();
31
32         void set_debug_name(const std::string &);
33
34         void bind_scratch();
35         static void unbind_scratch();
36 };
37
38 using TextureBackend = OpenGLTexture;
39
40 } // namespace GL
41 } // namespace Msp
42
43 #endif