X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexturecube.cpp;h=b0887ca85b1e4fca0e88769da87e4621f0d3af54;hb=9087cc0;hp=14ddf43d41c2cdc076e4489a62e2ed2e7341dd36;hpb=d6db27e633b1b8850fb093a8e5fad439ac3b0465;p=libs%2Fgl.git diff --git a/source/texturecube.cpp b/source/texturecube.cpp index 14ddf43d..b0887ca8 100644 --- a/source/texturecube.cpp +++ b/source/texturecube.cpp @@ -78,18 +78,19 @@ void TextureCube::allocate(unsigned level) { BindRestore _bind(this); glTexStorage2D(target, levels, ifmt, size, size); + apply_swizzle(); allocated |= (1<(img.get_data()); unsigned face_size = img.get_stride()*size; for(unsigned i=0; i<6; ++i) - image(enumerate_faces(i), 0, fmt, UNSIGNED_BYTE, cdata+i*face_size); + image(enumerate_faces(i), 0, comp, type, cdata+i*face_size); } unsigned TextureCube::get_n_levels() const @@ -274,6 +277,7 @@ void TextureCube::Loader::init() add("image_data", &Loader::image_data); add("raw_data", &Loader::raw_data); add("storage", &Loader::storage); + add("storage", &Loader::storage_levels); } void TextureCube::Loader::external_image(TextureCubeFace face, const string &fn) @@ -296,7 +300,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, get_base_pixelformat(obj.ifmt), UNSIGNED_BYTE, data.data()); + obj.image(face, 0, get_components(obj.ifmt), get_component_type(obj.ifmt), data.data()); } void TextureCube::Loader::storage(PixelFormat fmt, unsigned s) @@ -304,6 +308,11 @@ void TextureCube::Loader::storage(PixelFormat fmt, unsigned s) obj.storage(fmt, s); } +void TextureCube::Loader::storage_levels(PixelFormat fmt, unsigned s, unsigned l) +{ + obj.storage(fmt, s, l); +} + void operator>>(const LexicalConverter &conv, TextureCubeFace &face) {