]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texturecube.cpp
Make Animation::Iterator assignable
[libs/gl.git] / source / texturecube.cpp
index 833ef28f0ebd78add08ccfae4c8555df87dff288..db679cf9e1259cb4feb0e087c0f3e066c40921c3 100644 (file)
@@ -45,7 +45,6 @@ unsigned TextureCube::orientations[12] =
 
 TextureCube::TextureCube():
        Texture(GL_TEXTURE_CUBE_MAP),
-       ifmt(RGB),
        size(0),
        allocated(0)
 {
@@ -59,11 +58,7 @@ void TextureCube::storage(PixelFormat fmt, unsigned sz)
        if(sz==0)
                throw invalid_argument("TextureCube::storage");
 
-       if(MSP_sized_internal_formats)
-               fmt = get_sized_pixelformat(fmt);
-       require_pixelformat(fmt);
-
-       ifmt = fmt;
+       set_internal_format(fmt);
        size = sz;
 }
 
@@ -101,7 +96,7 @@ void TextureCube::image(TextureCubeFace face, unsigned level, PixelFormat fmt, D
                return sub_image(face, level, 0, 0, s, s, fmt, type, data);
 
        BindRestore _bind(this);
-       glTexImage2D(face, level, ifmt, s, s, 0, fmt, type, data);
+       glTexImage2D(face, level, ifmt, s, s, 0, get_upload_format(fmt), type, data);
 
        // XXX Allocation should be tracked per-face, but we'll run out of bits
        allocated |= 1<<level;
@@ -121,7 +116,7 @@ void TextureCube::sub_image(TextureCubeFace face, unsigned level, int x, int y,
        BindRestore _bind(this);
        allocate(level);
 
-       glTexSubImage2D(face, level, x, y, wd, ht, fmt, type, data);
+       glTexSubImage2D(face, level, x, y, wd, ht, get_upload_format(fmt), type, data);
 
        if(gen_mipmap && level==0)
                auto_generate_mipmap();