#include <msp/strings/format.h>
#include "bindable.h"
#include "error.h"
+#include "pixelstore.h"
#include "texturecube.h"
using namespace std;
if(s==0)
throw out_of_range("TextureCube::image");
- Bind _bind(this, true);
+ BindRestore _bind(this);
glTexImage2D(face, level, ifmt, s, s, 0, fmt, type, data);
// XXX Allocation should be tracked per-face, but we'll run out of bits
if(size==0)
{
if(w==h)
- storage(fmt, w);
+ storage(storage_pixelformat_from_graphics(img.get_format()), w);
else
throw incompatible_data("TextureCube::image");
}
else if(w!=size || h!=size)
throw incompatible_data("TextureCube::image");
+ PixelStore pstore = PixelStore::from_image(img);
+ BindRestore _bind_ps(pstore);
+
image(face, 0, fmt, UNSIGNED_BYTE, img.get_data());
}