]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/opengl/texture_backend.h
Move all OpenGL-specific code to a separate directory
[libs/gl.git] / source / backends / opengl / texture_backend.h
diff --git a/source/backends/opengl/texture_backend.h b/source/backends/opengl/texture_backend.h
new file mode 100644 (file)
index 0000000..f272d3d
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef MSP_GL_TEXTURE_BACKEND_H_
+#define MSP_GL_TEXTURE_BACKEND_H_
+
+#include <msp/core/noncopyable.h>
+
+namespace Msp {
+namespace GL {
+
+class OpenGLTexture: public NonCopyable
+{
+       friend class OpenGLFramebuffer;
+       friend class OpenGLPipelineState;
+
+protected:
+       unsigned id;
+       unsigned target;
+       std::string debug_name;
+
+       static int swizzle_orders[];
+       static OpenGLTexture *scratch_binding;
+
+       OpenGLTexture(unsigned, bool);
+       ~OpenGLTexture();
+
+       void generate_id();
+       void require_swizzle();
+       void apply_swizzle();
+       void set_parameter_i(unsigned, int) const;
+
+       void generate_mipmap();
+
+       void set_debug_name(const std::string &);
+
+       void bind_scratch();
+       static void unbind_scratch();
+};
+
+using TextureBackend = OpenGLTexture;
+
+} // namespace GL
+} // namespace Msp
+
+#endif