X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FTexture.cc;h=b778c1ccde0299b1e306d33724457728c563d65a;hp=8aa66c4f1ec7c64c95b3d35016f4ef1e9068593d;hb=5fa5f117f28922a7e539a432367960c1a61f837d;hpb=4701bf580b75a7d77a460c6f14f9fc31fb109bbb diff --git a/src/Moof/Texture.cc b/src/Moof/Texture.cc index 8aa66c4..b778c1c 100644 --- a/src/Moof/Texture.cc +++ b/src/Moof/Texture.cc @@ -34,6 +34,7 @@ #include #include "Dispatcher.hh" +#include "Log.hh" #include "Mippleton.hh" #include "OpenGL.hh" #include "Texture.hh" @@ -144,7 +145,7 @@ public: loadFromFile(); // we want to know when the GL context is recreated - Dispatcher::instance().addHandler("video.context_recreated", + Dispatcher::getInstance().addHandler("video.context_recreated", boost::bind(&Impl::contextRecreated, this, _1), this); } @@ -157,7 +158,7 @@ public: unloadFromGL(); - Dispatcher::instance().removeHandler(this); + Dispatcher::getInstance().removeHandler(this); } @@ -243,7 +244,8 @@ public: if (!surface) { - throw Texture::Exception("loading from file failed"); + logWarning("texture not found: %s", getName().c_str()); + throw Exception(Exception::FILE_NOT_FOUND); } SDL_Surface* temp = prepareImageForGL(surface); @@ -251,7 +253,7 @@ public: if (!temp) { - throw Texture::Exception("uploading to opengl failed"); + throw Exception(Exception::OPENGL_ERROR); } if (temp->format->BytesPerPixel == 3) @@ -265,7 +267,7 @@ public: else { SDL_FreeSurface(temp); - throw Texture::Exception("incompatible color mode"); + throw Exception(Exception::BAD_IMAGE_FORMAT); } width_ = temp->w; @@ -388,7 +390,7 @@ GLuint Texture::Impl::globalObject_ = 0; Texture::Texture(const std::string& name) : // pass through - impl_(Texture::Impl::retain(name), &Texture::Impl::release) {} + impl_(Texture::Impl::getInstance(name)) {} /**