- PixelFormat base_fmt = get_base_pixelformat(ifmt);
- DataType type = get_alloc_type(base_fmt);
- for(unsigned i=0; i<6; ++i)
- image(enumerate_faces(i), level, base_fmt, type, 0);
+ if(ARB_texture_storage)
+ {
+ BindRestore _bind(this);
+ unsigned n_levels = (is_mipmapped(min_filter) ? get_n_levels() : 1);
+ glTexStorage2D(target, n_levels, ifmt, size, size);
+ allocated |= (1<<n_levels)-1;
+ }
+ else
+ {
+ PixelFormat base_fmt = get_base_pixelformat(ifmt);
+ DataType type = get_alloc_type(base_fmt);
+ for(unsigned i=0; i<6; ++i)
+ image(enumerate_faces(i), level, base_fmt, type, 0);
+ }