]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/texture1d.cpp
Refactor get_level_size in various texture classes
[libs/gl.git] / source / core / texture1d.cpp
index d472527c92322f4d05b0fe39640f7f91905133a9..71c736f04da4ecb7971d22461434169445614f6b 100644 (file)
@@ -64,6 +64,8 @@ void Texture1D::image(unsigned level, const void *data)
 {
        if(width==0)
                throw invalid_operation("Texture1D::image");
+       if(level>=levels)
+               throw out_of_range("Texture1D::image");
 
        unsigned w = get_level_size(level);
 
@@ -100,7 +102,9 @@ void Texture1D::image(unsigned level, PixelComponents comp, DataType type, const
 void Texture1D::sub_image(unsigned level, int x, unsigned wd, const void *data)
 {
        if(width==0)
-               throw invalid_operation("Texture3D::image");
+               throw invalid_operation("Texture1D::sub_image");
+       if(level>=levels)
+               throw out_of_range("Texture1D::sub_image");
 
        Conditional<BindRestore> _bind(!ARB_direct_state_access, this);
        allocate(level);