]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture.h
Implement loading functionality for texture classes that were missing it
[libs/gl.git] / source / texture.h
index 4cd5481e2e18f570377c3f13d86b8b4dbf984cb8..3e050db57f359cc0d3a9f514d828491c6a81cce0 100644 (file)
@@ -2,6 +2,7 @@
 #define MSP_GL_TEXTURE_H_
 
 #include <msp/datafile/objectloader.h>
+#include <msp/graphics/image.h>
 #include "datatype.h"
 #include "gl.h"
 #include "pixelformat.h"
@@ -82,6 +83,7 @@ protected:
 
                void filter(TextureFilter);
                void generate_mipmap(bool);
+               void image_data(const std::string &);
                void mag_filter(TextureFilter);
                void max_anisotropy(float);
                void min_filter(TextureFilter);
@@ -161,6 +163,17 @@ public:
        /** Sets the function to use for depth comparison. */
        void set_compare_func(Predicate);
 
+       /// Loads a Graphics::Image from a file and uploads it to the texture.
+       virtual void load_image(const std::string &, bool srgb = false);
+
+       /** Uploads an image to the texture.  If storage has not been defined, it
+       will be set to match the image.  Otherwise the image must be compatible
+       with the defined storage.  Semantics depend on the type of texture.
+
+       If srgb is true and storage is determined by this call, then an sRGB pixel
+       format will be used. */
+       virtual void image(const Graphics::Image &, bool srgb = false) = 0;
+
        GLenum get_target() const { return target; }
        unsigned get_id() const { return id; }