]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texturecube.cpp
Use base pixelformat when loading texture data
[libs/gl.git] / source / texturecube.cpp
index 38d99367fe4441d431a7699d08515fc8977ae025..d5453c182e128b13e201cb87d7b738e38caefd00 100644 (file)
@@ -59,7 +59,7 @@ void TextureCube::image(TextureCubeFace face, unsigned level, PixelFormat fmt, D
        if(s==0)
                throw out_of_range("TextureCube::image");
 
-       Bind _bind(this, true);
+       BindRestore _bind(this);
        glTexImage2D(face, level, ifmt, s, s, 0, fmt, type, data);
 
        // XXX Allocation should be tracked per-face, but we'll run out of bits
@@ -87,7 +87,7 @@ void TextureCube::image(TextureCubeFace face, const Graphics::Image &img)
                throw incompatible_data("TextureCube::image");
 
        PixelStore pstore = PixelStore::from_image(img);
-       Bind _bind_ps(pstore, true);
+       BindRestore _bind_ps(pstore);
 
        image(face, 0, fmt, UNSIGNED_BYTE, img.get_data());
 }
@@ -183,7 +183,7 @@ void TextureCube::Loader::image_data(TextureCubeFace face, const string &data)
 
 void TextureCube::Loader::raw_data(TextureCubeFace face, const string &data)
 {
-       obj.image(face, 0, obj.ifmt, UNSIGNED_BYTE, data.data());
+       obj.image(face, 0, get_base_pixelformat(obj.ifmt), UNSIGNED_BYTE, data.data());
 }
 
 void TextureCube::Loader::storage(PixelFormat fmt, unsigned s)