- unsigned wd=png_get_image_width(pngs, pngi);
- unsigned ht=png_get_image_height(pngs, pngi);
- unsigned depth=png_get_bit_depth(pngs, pngi);
- unsigned ctype=png_get_color_type(pngs, pngi);
+void Texture2D::image(const Graphics::Image &img)
+{
+ unsigned w = img.get_width();
+ unsigned h = img.get_height();
+ PixelFormat fmt = pixelformat_from_graphics(img.get_format());
+ if(width==0)
+ storage(fmt, w, h);
+ else if(w!=width || h!=height)
+ throw incompatible_data("Texture2D::image");
+
+ image(0, fmt, UNSIGNED_BYTE, img.get_data());
+}