#include <msp/datafile/collection.h>
#include <msp/gl/extensions/ext_texture_array.h>
#include "error.h"
-#include "pixelstore.h"
#include "texture2darray.h"
using namespace std;
void Texture2DArray::layer_image(unsigned level, unsigned z, const void *data)
{
- unsigned w = get_width();
- unsigned h = get_height();
- unsigned d = get_depth();
- get_level_size(level, w, h, d);
+ if(level>=levels || z>=depth)
+ throw out_of_range("Texture2DArray::layer_image");
- sub_image(level, 0, 0, z, w, h, 1, data);
+ LinAl::Vector<unsigned, 3> size = get_level_size(level);
+ sub_image(level, 0, 0, z, size.x, size.y, 1, data);
}
void Texture2DArray::layer_image(unsigned level, unsigned z, PixelComponents comp, DataType type, const void *data)
if(get_components(fmt)!=get_components(format) || get_component_type(fmt)!=get_component_type(format))
throw incompatible_data("Texture2DArray::layer_image");
- PixelStore pstore = PixelStore::from_image(img);
- BindRestore _bind_ps(pstore);
-
layer_image(level, z, img.get_pixels());
}