]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texturecube.cpp
Deal with nontrivial image configurations
[libs/gl.git] / source / texturecube.cpp
index eb7448c324ea14c7e82e0dd0da32ba8d9e30ed87..38d99367fe4441d431a7699d08515fc8977ae025 100644 (file)
@@ -3,6 +3,7 @@
 #include <msp/strings/format.h>
 #include "bindable.h"
 #include "error.h"
+#include "pixelstore.h"
 #include "texturecube.h"
 
 using namespace std;
@@ -78,13 +79,16 @@ void TextureCube::image(TextureCubeFace face, const Graphics::Image &img)
        if(size==0)
        {
                if(w==h)
-                       storage(fmt, w);
+                       storage(storage_pixelformat_from_graphics(img.get_format()), w);
                else
                        throw incompatible_data("TextureCube::image");
        }
        else if(w!=size || h!=size)
                throw incompatible_data("TextureCube::image");
 
+       PixelStore pstore = PixelStore::from_image(img);
+       Bind _bind_ps(pstore, true);
+
        image(face, 0, fmt, UNSIGNED_BYTE, img.get_data());
 }