9 enum TextureType { TEX_2D, TEX_CUBE };
18 static Image *default_img;
20 Texture(const Texture &tex) {}
21 Texture &operator =(const Texture &tex) { return *this; }
23 void set_image_2d(const Image &img);
24 bool set_image_cube(const Image &img, int idx);
25 bool set_image_cube(const Image &img);
27 bool load_cube(const char *fname);
29 /* for loading multiple cubemap faces from a single image */
30 bool set_cube_multi(const Image &img, const float *xoffsets, const float *yoffsets, float sz,
31 unsigned int rotmask = 0);
37 void set_wrapping(unsigned int wrap);
38 void set_filtering(unsigned int filt);
39 void set_filtering(unsigned int min_filt, unsigned int mag_filt);
41 unsigned int get_format() const;
43 int get_size(int dim) const;
45 void create(int xsz, int ysz, TextureType type = TEX_2D, unsigned int ifmt = GL_RGBA);
46 void create_default(TextureType type = TEX_2D);
47 void set_image(const Image &img, int idx = -1);
49 bool load(const char *fname);
51 unsigned int get_id() const;
52 TextureType get_type() const;
54 void bind(int tex_unit = 0) const;
56 friend class TextureSet;
59 void bind_texture(Texture *tex, int tunit = 0);
61 class TextureSet : public DataSet<Texture*> {
63 static Texture *create_tex();
64 static bool load_tex(Texture *tex, const char *fname);
65 static bool done_tex(Texture *tex);
66 static void free_tex(Texture *tex);
71 Texture *get_texture(const char *name, TextureType type = TEX_2D) const;