#ifndef _TEXTURE_HH_
#define _TEXTURE_HH_
+/**
+ * @file texture.hh
+ * Image-loading and OpenGL texture loading.
+ */
+
+#include <stdexcept>
+
#include <boost/shared_ptr.hpp>
#include "opengl.hh"
+#include "resource.hh"
namespace dc {
-class texture_impl;
-
-class texture
+class texture : public resource
{
public:
- texture(const std::string& filePath, bool keepInMemory = false);
-
- const std::string& filePath();
+ texture(const std::string& name);
void bind();
- GLuint object();
+ GLuint getObject();
+
+ unsigned getWidth();
+ unsigned getHeight();
- unsigned width();
- unsigned height();
+ void setMinFilter(GLuint filter);
+ void setMaxFilter(GLuint filter);
+ void setWrapU(GLuint wrap);
+ void setWrapV(GLuint wrap);
+
+ void applyChanges();
+
+ static std::string getPathToResource(const std::string& name);
+
+ struct exception : std::runtime_error
+ {
+ explicit exception(const std::string& what_arg) :
+ std::runtime_error(what_arg) {}
+ };
private:
+ class texture_impl;
boost::shared_ptr<texture_impl> impl;
};
#endif // _TEXTURE_HH_
+/** vim: set ts=4 sw=4 tw=80: *************************************************/
+