X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexture2d.cpp;h=1e9ec90344e242608caa55501268a08775a54aa2;hb=dbc91b65728ab9c0e574bb1127cfe4d2da55de7f;hp=0e76128c7bc5666da5828f11fe98f5398ecaf380;hpb=7aaec9a70b8d7733429bec043f8e33e02956f266;p=libs%2Fgl.git diff --git a/source/core/texture2d.cpp b/source/core/texture2d.cpp index 0e76128c..1e9ec903 100644 --- a/source/core/texture2d.cpp +++ b/source/core/texture2d.cpp @@ -50,7 +50,11 @@ Texture2D::~Texture2D() void Texture2D::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned lv) { if(width>0) - throw invalid_operation("Texture2D::storage"); + { + if(fmt!=format || wd!=width || ht!=height || (lv && lv!=levels)) + throw incompatible_data("Texture2D::storage"); + return; + } if(wd==0 || ht==0) throw invalid_argument("Texture2D::storage"); @@ -106,7 +110,7 @@ void Texture2D::image(unsigned level, const void *data) } PixelComponents comp = get_components(storage_fmt); - DataType type = get_component_type(storage_fmt); + GLenum type = get_gl_type(get_component_type(storage_fmt)); glTexImage2D(target, level, storage_fmt, w, h, 0, comp, type, data); allocated |= 1<