]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture3d.cpp
Fix 3D texture loading with fixed depth
[libs/gl.git] / source / texture3d.cpp
index 4aac49edfaf82f27eaf4c3eef8c7021596d5033e..30363acc3d8046ff10fd73f9b6271bce4c353b4c 100644 (file)
@@ -99,7 +99,14 @@ void Texture3D::load_image(const string &fn, int dp)
                h = d;
        }
        else if(dp>0)
+       {
                d = dp;
+               if(h%d)
+                       throw incompatible_data("Texture3D::load_image");
+               h /= d;
+       }
+       else
+               throw invalid_argument("Texture3D::load_image");
 
        PixelFormat fmt = pixelformat_from_graphics(img.get_format());
        if(width==0)