]> git.tdb.fi Git - libs/gl.git/blob - source/backends/opengl/texture_backend.h
69756206ac9aa3f4966e9d13f27bede59d02ea56
[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 = 0;
16         unsigned target;
17         std::string debug_name;
18
19         static OpenGLTexture *scratch_binding;
20
21         OpenGLTexture(unsigned);
22         ~OpenGLTexture();
23
24         void create();
25         void require_swizzle();
26         void apply_swizzle();
27         void set_parameter_i(unsigned, int) const;
28
29         void generate_mipmap();
30
31         void set_debug_name(const std::string &);
32
33         void bind_scratch();
34         static void unbind_scratch();
35 };
36
37 using TextureBackend = OpenGLTexture;
38
39 } // namespace GL
40 } // namespace Msp
41
42 #endif