]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texturecube.cpp
Simplify applying texture swizzling
[libs/gl.git] / source / texturecube.cpp
index 0613a39a8ebba335a56f42a9ec958c9a796ac45e..8d194c42028bb6a4c6eb56cf2e9c0cb9567eba71 100644 (file)
@@ -78,6 +78,7 @@ void TextureCube::allocate(unsigned level)
        {
                BindRestore _bind(this);
                glTexStorage2D(target, levels, ifmt, size, size);
+               apply_swizzle();
                allocated |= (1<<levels)-1;
        }
        else
@@ -104,7 +105,10 @@ void TextureCube::image(TextureCubeFace face, unsigned level, PixelFormat fmt, D
        BindRestore _bind(this);
 
        if(!allocated)
+       {
                glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, levels-1);
+               apply_swizzle();
+       }
        glTexImage2D(face, level, ifmt, s, s, 0, get_upload_format(fmt), type, data);
 
        if(level==0)