X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture2d.cpp;h=8ecebdfb6e1748132bf39a14040f5bae8704aa33;hb=bdde5adcb78836c4d75196546059ae827cf3af9e;hp=4d6e32f5550cd6f48ee68c71d957278b7ffe355e;hpb=6f8c0c6c088be92804cb413c0234bfb817ef2d8d;p=libs%2Fgl.git diff --git a/source/texture2d.cpp b/source/texture2d.cpp index 4d6e32f5..8ecebdfb 100644 --- a/source/texture2d.cpp +++ b/source/texture2d.cpp @@ -1,3 +1,5 @@ +#include +#include #include #include "bindable.h" #include "buffer.h" @@ -68,9 +70,14 @@ void Texture2D::allocate(unsigned level) if(ARB_texture_storage) { - BindRestore _bind(this); unsigned n_levels = (is_mipmapped(min_filter) ? get_n_levels() : 1); - glTexStorage2D(target, n_levels, ifmt, width, height); + if(ARB_direct_state_access) + glTextureStorage2D(id, n_levels, ifmt, width, height); + else + { + BindRestore _bind(this); + glTexStorage2D(target, n_levels, ifmt, width, height); + } allocated |= (1< _bind(!ARB_direct_state_access, this); allocate(level); - BindRestore _bind(this); - glTexSubImage2D(target, level, x, y, wd, ht, fmt, type, data); + if(ARB_direct_state_access) + glTextureSubImage2D(id, level, x, y, wd, ht, fmt, type, data); + else + glTexSubImage2D(target, level, x, y, wd, ht, fmt, type, data); if(gen_mipmap && level==0) auto_generate_mipmap();