#ifndef _dmsTexture2D_h_
#define _dmsTexture2D_h_

#include <GL/gl.h>
#include <dms/Texture.h>
#include <dms/Image.h>

namespace dms
{

class Texture2D : public Texture
    {
    public:
        Texture2D(char *filename=0, GLint wrap=GL_REPEAT, GLint min=GL_LINEAR, GLint mag=GL_LINEAR);
        Texture2D(Image& image, GLint wrap=GL_REPEAT, GLint min=GL_LINEAR, GLint mag=GL_LINEAR);
        virtual ~Texture2D(void);
        virtual void apply(void);
        virtual void disable(void);
        void define(void);
        void subload(GLint xoffset=0,GLint yoffset=0);
        
        void setImage(Image&);
        Image& image(void) const { return *image_; }
        
    private:
        Image * image_;
        GLuint id_;
        void *rescaledImageData_;
        bool defined_;
        bool createdImage_;
    };

}

#endif
