X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftexture1d.cpp;h=32053e83fa9bd8ad9231720c79defa3474229415;hp=ed7d8f6e2b877fd4f660d71dbdc72874ef3de34b;hb=08e19bc2b4eba572bc7699378cf55cd8772ac67e;hpb=b2c8b2238877f76cdea184cca70336b15ddb78d9 diff --git a/source/texture1d.cpp b/source/texture1d.cpp index ed7d8f6e..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); - 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();