* Image-loading and OpenGL texture loading.
*/
-#include <stdexcept>
-
#include <boost/shared_ptr.hpp>
#include <Moof/OpenGL.hh>
namespace Mf {
+class Texture;
+typedef boost::shared_ptr<Texture> TextureP;
+
+
class Texture : public Resource
{
public:
- Texture(const std::string& name);
+
+ static TextureP alloc(const std::string& name)
+ {
+ return TextureP(new Texture(name));
+ }
+
+ explicit Texture(const std::string& name);
void bind() const;
GLuint getObject() const;
+ static void resetBind();
+
unsigned getWidth() const;
unsigned getHeight() const;
void setWrapS(GLuint wrap);
void setWrapT(GLuint wrap);
- 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) {}
- };
+ static std::string getPath(const std::string& name);
private:
- class TextureImpl;
- boost::shared_ptr<TextureImpl> impl_;
+
+ class Impl;
+ boost::shared_ptr<Impl> mImpl;
};