X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture2darray.cpp;h=34b9532d3e80965dbc6777a2ff4d0e60a191d8ab;hb=9087cc0;hp=4123f0e2906e261b64fe0227c27894a00f8c7a09;hpb=af38b327d25410b87084fe937b311ebde1ba6c5d;p=libs%2Fgl.git diff --git a/source/texture2darray.cpp b/source/texture2darray.cpp index 4123f0e2..34b9532d 100644 --- a/source/texture2darray.cpp +++ b/source/texture2darray.cpp @@ -15,14 +15,14 @@ Texture2DArray::Texture2DArray(): static Require _req(EXT_texture_array); } -void Texture2DArray::layer_image(unsigned level, unsigned z, PixelFormat fmt, DataType type, const void *data) +void Texture2DArray::layer_image(unsigned level, unsigned z, PixelComponents comp, DataType type, const void *data) { unsigned w = get_width(); unsigned h = get_height(); unsigned d = get_depth(); get_level_size(level, w, h, d); - sub_image(level, 0, 0, z, w, h, 1, fmt, type, data); + sub_image(level, 0, 0, z, w, h, 1, comp, type, data); } void Texture2DArray::layer_image(unsigned level, unsigned z, const Graphics::Image &img) @@ -32,14 +32,14 @@ void Texture2DArray::layer_image(unsigned level, unsigned z, const Graphics::Ima unsigned w = img.get_width(); unsigned h = img.get_height(); - PixelFormat fmt = pixelformat_from_graphics(img.get_format()); + PixelFormat fmt = pixelformat_from_image(img); if(w!=get_width() || h!=get_height()) throw incompatible_data("Texture2DArray::layer_image"); PixelStore pstore = PixelStore::from_image(img); BindRestore _bind_ps(pstore); - layer_image(level, z, fmt, UNSIGNED_BYTE, img.get_data()); + layer_image(level, z, get_components(fmt), get_component_type(fmt), img.get_data()); } @@ -64,6 +64,8 @@ void Texture2DArray::Loader::external_image(unsigned z, const string &fn) { Graphics::Image img; RefPtr io = get_collection().open_raw(fn); + if(!io) + throw IO::file_not_found(fn); img.load_io(*io); obj.layer_image(0, z, img);