X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture1d.cpp;h=32053e83fa9bd8ad9231720c79defa3474229415;hb=bdde5adcb78836c4d75196546059ae827cf3af9e;hp=e5a496a455095093c89502d15c3727dd7306ecec;hpb=6f8c0c6c088be92804cb413c0234bfb817ef2d8d;p=libs%2Fgl.git diff --git a/source/texture1d.cpp b/source/texture1d.cpp index e5a496a4..32053e83 100644 --- a/source/texture1d.cpp +++ b/source/texture1d.cpp @@ -1,3 +1,5 @@ +#include +#include #include #include #include "bindable.h" @@ -40,9 +42,14 @@ void Texture1D::allocate(unsigned level) if(ARB_texture_storage) { - BindRestore _bind(this); unsigned n_levels = (is_mipmapped(min_filter) ? get_n_levels() : 1); - glTexStorage1D(target, n_levels, ifmt, width); + if(ARB_direct_state_access) + glTextureStorage1D(id, n_levels, ifmt, width); + else + { + BindRestore _bind(this); + glTexStorage1D(target, n_levels, ifmt, width); + } allocated |= (1< _bind(!ARB_direct_state_access, this); allocate(level); - BindRestore _bind(this); - glTexSubImage1D(target, level, x, wd, fmt, type, data); + if(ARB_direct_state_access) + glTextureSubImage1D(id, level, x, wd, fmt, type, data); + else + glTexSubImage1D(target, level, x, wd, fmt, type, data); if(gen_mipmap && level==0) auto_generate_mipmap();