-#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;
namespace Msp {
namespace GL {
-Texture2DArray::Texture2DArray():
- Texture3D(GL_TEXTURE_2D_ARRAY)
-{
- static Require _req(EXT_texture_array);
-}
-
void Texture2DArray::layer_image(unsigned level, unsigned z, const void *data)
{
if(level>=levels || z>=depth)
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(comp!=get_components(format) || type!=get_component_type(format))
- throw incompatible_data("Texture2DArray::layer_image");
- layer_image(level, z, data);
-}
-
void Texture2DArray::layer_image(unsigned level, unsigned z, const Graphics::Image &img)
{
if(!get_width())
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());
}