X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftexture.h;h=f1a51767f577771477289c582375ab2170c98c11;hp=db6165fed82628206f29d69b39036d2160edefca;hb=08e19bc2b4eba572bc7699378cf55cd8772ac67e;hpb=7d7a8f9e77a526fd5f2920b9005805e56a4b686c diff --git a/source/texture.h b/source/texture.h index db6165fe..f1a51767 100644 --- a/source/texture.h +++ b/source/texture.h @@ -2,7 +2,10 @@ #define MSP_GL_TEXTURE_H_ #include +#include +#include "datatype.h" #include "gl.h" +#include "pixelformat.h" #include "predicate.h" #include "resource.h" @@ -78,8 +81,10 @@ protected: private: void init(); + void external_image(const std::string &); 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); @@ -122,7 +127,11 @@ public: ~Texture(); protected: + static DataType get_alloc_type(PixelFormat); + void update_parameter(int) const; + void set_parameter_i(GLenum, int) const; + void set_parameter_f(GLenum, float) const; public: void set_min_filter(TextureFilter); void set_mag_filter(TextureFilter); @@ -157,6 +166,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; } @@ -170,6 +190,9 @@ public: virtual UInt64 get_data_size() const { return 0; } }; + +bool is_mipmapped(TextureFilter); + } // namespace GL } // namespace Msp