From f35a2d2a9a092e692d37f7e25cf9086a95b8c99f Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 30 Dec 2008 00:42:04 +0000 Subject: [PATCH] fix reload some more --- panda/src/gobj/texture.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index a014f6609c..94301ce102 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -3027,6 +3027,8 @@ do_reload_ram_image(bool allow_compression) { } _loaded_from_image = false; + Format orig_format = _format; + int orig_num_components = _num_components; LoaderOptions options; options.set_texture_flags(LoaderOptions::TF_preload); @@ -3034,6 +3036,12 @@ do_reload_ram_image(bool allow_compression) { _primary_file_num_channels, _alpha_file_channel, z, n, _has_read_pages, _has_read_mipmaps, options, NULL); + if (orig_num_components == _num_components) { + // Restore the original format, in case it was needlessly changed + // during the reload operation. + _format = orig_format; + } + if (do_has_ram_image() && record != (BamCacheRecord *)NULL) { if (cache->get_cache_textures() || (_ram_image_compression != CM_off && cache->get_cache_compressed_textures())) { // Update the cache.