X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexturecube.cpp;h=9ea33eabc1658213c63082a6e09dd5037d3380af;hb=218b613dc4d3898996bfda8e3ce1db32f7e1f929;hp=0613a39a8ebba335a56f42a9ec958c9a796ac45e;hpb=fb5ca4dbba257d3eb7fa15800d9663b774e41e7e;p=libs%2Fgl.git diff --git a/source/texturecube.cpp b/source/texturecube.cpp index 0613a39a..9ea33eab 100644 --- a/source/texturecube.cpp +++ b/source/texturecube.cpp @@ -58,7 +58,7 @@ void TextureCube::storage(PixelFormat fmt, unsigned sz, unsigned lv) if(sz==0) throw invalid_argument("TextureCube::storage"); - set_internal_format(fmt); + set_format(fmt); size = sz; levels = get_n_levels(); if(lv>0) @@ -77,19 +77,18 @@ void TextureCube::allocate(unsigned level) if(ARB_texture_storage) { BindRestore _bind(this); - glTexStorage2D(target, levels, ifmt, size, size); + glTexStorage2D(target, levels, storage_fmt, 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, cdata+i*face_size); } unsigned TextureCube::get_n_levels() const @@ -249,7 +275,7 @@ Vector3 TextureCube::get_texel_direction(TextureCubeFace face, unsigned u, unsig UInt64 TextureCube::get_data_size() const { - return id ? size*size*6*get_pixel_size(ifmt) : 0; + return id ? size*size*6*get_pixel_size(storage_fmt) : 0; } @@ -280,7 +306,7 @@ void TextureCube::Loader::external_image(TextureCubeFace face, const string &fn) RefPtr io = get_collection().open_raw(fn); img.load_io(*io); - obj.image(face, img, srgb); + obj.image(face, img); } void TextureCube::Loader::image_data(TextureCubeFace face, const string &data) @@ -289,12 +315,12 @@ void TextureCube::Loader::image_data(TextureCubeFace face, const string &data) IO::Memory mem(data.data(), data.size()); img.load_io(mem); - obj.image(face, img, srgb); + obj.image(face, img); } 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, data.data()); } void TextureCube::Loader::storage(PixelFormat fmt, unsigned s)