X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Ftexture2darray.cpp;h=1928d4e3503c6f68f2446125ffe4b423c96ac5fc;hp=1ecb4cf2be69e1b34a28f1f8b8cea643b84e2325;hb=2b7f8e45e75bec30c1ea27fc0efd8286f67adc3f;hpb=aff68a183a4b33653750acc57a021fd7ed6c555c diff --git a/source/core/texture2darray.cpp b/source/core/texture2darray.cpp index 1ecb4cf2..1928d4e3 100644 --- a/source/core/texture2darray.cpp +++ b/source/core/texture2darray.cpp @@ -17,12 +17,11 @@ Texture2DArray::Texture2DArray(): 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 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)