- GLuint handle;
- unsigned int width;
- unsigned int height;
-
- Texture(unsigned int width, unsigned int height, GLenum glformat);
- Texture(SDL_Surface* surface, GLenum glformat);
- ~Texture();
-
- void upload_texture(SDL_Surface* image, int src_x, int src_y, int dst_x, int dst_y,
- int width, int height);
+ Texture() : refcount(0), filename() {}
+ virtual ~Texture() {}
+
+ virtual unsigned int get_texture_width() const = 0;
+ virtual unsigned int get_texture_height() const = 0;
+ virtual unsigned int get_image_width() const = 0;
+ virtual unsigned int get_image_height() const = 0;
+
+ std::string get_filename() const
+ {
+ return filename;
+ }
+
+ void set_filename(std::string filename)
+ {
+ this->filename = filename;
+ }
+
+ void ref()
+ {
+ refcount++;
+ }
+
+ void unref()
+ {
+ assert(refcount > 0);
+ refcount--;
+ if(refcount == 0)
+ release();
+ }
+