using namespace std;
-#include <iostream>
-
namespace Msp {
namespace GL {
void Texture2D::load_image(const string &fn)
{
Image img;
- img.load(fn);
+ img.load_file(fn);
+
+ image(img);
+}
+void Texture2D::image(const Image &img)
+{
unsigned w=img.get_width();
unsigned h=img.get_height();
PixelFormat fmt=img.get_format();
image(0, fmt, GL_UNSIGNED_BYTE, img.get_data());
}
+
+Texture2D::Loader::Loader(Texture2D &t):
+ Texture::Loader(t)
+{
+ add("image_data", &Loader::image_data);
+}
+
+void Texture2D::Loader::image_data(const string &data)
+{
+ Image img;
+ img.load_lump(data.data(), data.size());
+
+ static_cast<Texture2D &>(tex).image(img);
+}
+
} // namespace GL
} // namespace Msp