X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexturecube.cpp;h=7f8301187c35e07257037aec9967ad6b502e83a8;hb=47af19a447e6c13257ca2d0aef606ea45f8a0d98;hp=eb7448c324ea14c7e82e0dd0da32ba8d9e30ed87;hpb=804ad5d99c575b92e9d47421947e963a44f7a905;p=libs%2Fgl.git diff --git a/source/texturecube.cpp b/source/texturecube.cpp index eb7448c3..7f830118 100644 --- a/source/texturecube.cpp +++ b/source/texturecube.cpp @@ -3,6 +3,7 @@ #include #include "bindable.h" #include "error.h" +#include "pixelstore.h" #include "texturecube.h" using namespace std; @@ -58,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 @@ -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); + BindRestore _bind_ps(pstore); + image(face, 0, fmt, UNSIGNED_BYTE, img.get_data()); }