#include <SDL/SDL_image.h>
#include "Dispatcher.hh"
+#include "Log.hh"
#include "Mippleton.hh"
#include "OpenGL.hh"
#include "Texture.hh"
-#include <iostream>
namespace Mf {
void contextRecreated(const Notification* note)
{
- std::cout << "context recrated!" << std::endl;
object_ = globalObject_ = 0;
uploadToGL();
}
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);
if (!temp)
{
- throw Texture::Exception("uploading to opengl failed");
+ throw Exception(Exception::OPENGL_ERROR);
}
if (temp->format->BytesPerPixel == 3)
else
{
SDL_FreeSurface(temp);
- throw Texture::Exception("incompatible color mode");
+ throw Exception(Exception::BAD_IMAGE_FORMAT);
}
width_ = temp->w;
Texture::Texture(const std::string& name) :
// pass through
- impl_(Texture::Impl::retain(name), &Texture::Impl::release) {}
+ impl_(Texture::Impl::getInstance(name)) {}
/**