X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexturecube.cpp;h=01820fa8766be6afa5235419c5da9d63062a6388;hb=2d3113a7dbbe4be2f1d1e8980c1c4e42175163da;hp=3e0b9fc14d2b430cd16040f743294b0aae502419;hpb=ea1c10790b3f33b60c66c922f373e8a89be4dd92;p=libs%2Fgl.git diff --git a/source/core/texturecube.cpp b/source/core/texturecube.cpp index 3e0b9fc1..01820fa8 100644 --- a/source/core/texturecube.cpp +++ b/source/core/texturecube.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -49,12 +50,18 @@ TextureCube::TextureCube(): allocated(0) { static Require _req(ARB_texture_cube_map); + if(ARB_seamless_cube_map) + glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); } void TextureCube::storage(PixelFormat fmt, unsigned sz, unsigned lv) { if(size>0) - throw invalid_operation("TextureCube::storage"); + { + if(fmt!=format || sz!=size || (lv && lv!=levels)) + throw incompatible_data("TextureCube::storage"); + return; + } if(sz==0) throw invalid_argument("TextureCube::storage"); @@ -169,17 +176,12 @@ void TextureCube::image(TextureCubeFace face, const Graphics::Image &img) { unsigned w = img.get_width(); unsigned h = img.get_height(); - PixelFormat fmt = pixelformat_from_image(img); - if(size==0) - { - if(w!=h) - throw incompatible_data("TextureCube::image"); - - storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w); - } - else if(w!=size || h!=size) + if(w!=h) throw incompatible_data("TextureCube::image"); + PixelFormat fmt = pixelformat_from_image(img); + storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w); + PixelStore pstore = PixelStore::from_image(img); BindRestore _bind_ps(pstore);