X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FTexture.cc;h=b778c1ccde0299b1e306d33724457728c563d65a;hp=e8f5d86d1f2e65fd85d413c5b93b26bfcedc6ac3;hb=7e898e8ec0ff716e2fc722b883a626a6c346f107;hpb=bfa6212d09d8735d8fd5e2638188e4a99f21ada4 diff --git a/src/Moof/Texture.cc b/src/Moof/Texture.cc index e8f5d86..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" @@ -78,7 +79,7 @@ class Texture::Impl : public Mippleton * to cache it if the client has plenty of RAM. */ - void contextRecreated(const Notification& note) + void contextRecreated(const Notification* note) { object_ = globalObject_ = 0; uploadToGL(); @@ -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)) {} /**