X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexture3d.cpp;fp=source%2Fcore%2Ftexture3d.cpp;h=a268857d4996cd9bc08d98d9d5c8918bc7d25a3c;hb=4ae2ffa3057af9524a84ba322c0db32d6fcae8f2;hp=1681f83c6f528b949be627adb9fddf311556806a;hpb=0d765be40336decc966932e0143fe9496f3eab4b;p=libs%2Fgl.git diff --git a/source/core/texture3d.cpp b/source/core/texture3d.cpp index 1681f83c..a268857d 100644 --- a/source/core/texture3d.cpp +++ b/source/core/texture3d.cpp @@ -36,7 +36,11 @@ Texture3D::Texture3D(): void Texture3D::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned dp, unsigned lv) { if(width>0) - throw invalid_operation("Texture3D::storage"); + { + if(fmt!=format || wd!=width || ht!=height || dp!=depth || (lv && lv!=levels)) + throw incompatible_data("Texture3D::storage"); + return; + } if(wd==0 || ht==0 || dp==0) throw invalid_argument("Texture3D::storage"); @@ -149,10 +153,7 @@ void Texture3D::image(const Graphics::Image &img, unsigned lv) h = w; PixelFormat fmt = pixelformat_from_image(img); - if(width==0) - storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w, h, d, lv); - else if(w!=width || h!=height || d!=depth) - throw incompatible_data("Texture3D::load_image"); + storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w, h, d, lv); PixelStore pstore = PixelStore::from_image(img); BindRestore _bind_ps(pstore);