X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture2d.cpp;h=559167f8ba4d5eefc017e6e158d76dec55127cf6;hb=73eec11d44a24bac121f1b0d85f20d58005f3545;hp=45c2e665d056973ee4ecdb41eb6033dd831c2b5b;hpb=40e1eba6c489e11a4c9b8865ddcd3ec3d9f83818;p=libs%2Fgl.git diff --git a/source/texture2d.cpp b/source/texture2d.cpp index 45c2e665..559167f8 100644 --- a/source/texture2d.cpp +++ b/source/texture2d.cpp @@ -72,13 +72,12 @@ void Texture2D::allocate(unsigned level) if(ARB_texture_storage) { + Conditional _bind(!ARB_direct_state_access, this); if(ARB_direct_state_access) glTextureStorage2D(id, levels, ifmt, width, height); else - { - BindRestore _bind(this); glTexStorage2D(target, levels, ifmt, width, height); - } + apply_swizzle(); allocated |= (1<(pixel_buffer.map(WRITE_ONLY)); + pixel_buffer.storage(n_bytes); + mapped_address = reinterpret_cast(pixel_buffer.map()); } else if(phase==2) { @@ -272,8 +278,13 @@ bool Texture2D::AsyncLoader::process() } if(!texture.id) - glGenTextures(1, &texture.id); - texture.image(image, srgb_conversion, true); + { + if(ARB_direct_state_access) + glCreateTextures(texture.target, 1, &texture.id); + else + glGenTextures(1, &texture.id); + } + texture.image(image, 0, srgb_conversion, true); } ++phase;