diff --git a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx index 6a78ea574d..f57994f90e 100644 --- a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx +++ b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx @@ -1497,7 +1497,7 @@ update_texture(TextureContext *tc, bool force) { if (gtc->was_image_modified() || gltex->num_levels == 0) { // If the texture image was modified, reload the texture. - bool okflag = upload_texture(gtc); + bool okflag = upload_texture(gtc, force); if (!okflag) { tinydisplay_cat.error() << "Could not load " << *gtc->get_texture() << "\n"; @@ -2076,21 +2076,23 @@ apply_texture(TextureContext *tc) { // the texture has no image. //////////////////////////////////////////////////////////////////// bool TinyGraphicsStateGuardian:: -upload_texture(TinyTextureContext *gtc) { +upload_texture(TinyTextureContext *gtc, bool force) { Texture *tex = gtc->get_texture(); - if (_incomplete_render && - !tex->has_uncompressed_ram_image() && tex->might_have_ram_image() && - tex->has_simple_ram_image() && - !_loader.is_null()) { - // If we don't have the texture data right now, go get it, but in - // the meantime load a temporary simple image in its place. - async_reload_texture(gtc); - if (!tex->has_ram_image()) { - if (gtc->was_simple_image_modified()) { - return upload_simple_texture(gtc); + if (_incomplete_render && !force) { + bool has_image = _supports_compressed_texture ? tex->has_ram_image() : tex->has_uncompressed_ram_image(); + if (!has_image && tex->might_have_ram_image() && + tex->has_simple_ram_image() && + !_loader.is_null()) { + // If we don't have the texture data right now, go get it, but in + // the meantime load a temporary simple image in its place. + async_reload_texture(gtc); + if (!tex->has_ram_image()) { + if (gtc->was_simple_image_modified()) { + return upload_simple_texture(gtc); + } + return true; } - return true; } } diff --git a/panda/src/tinydisplay/tinyGraphicsStateGuardian.h b/panda/src/tinydisplay/tinyGraphicsStateGuardian.h index 1f4535b674..7afef0e2f4 100644 --- a/panda/src/tinydisplay/tinyGraphicsStateGuardian.h +++ b/panda/src/tinydisplay/tinyGraphicsStateGuardian.h @@ -108,7 +108,7 @@ private: void set_scissor(float left, float right, float bottom, float top); bool apply_texture(TextureContext *tc); - bool upload_texture(TinyTextureContext *gtc); + bool upload_texture(TinyTextureContext *gtc, bool force); bool upload_simple_texture(TinyTextureContext *gtc); bool setup_gltex(GLTexture *gltex, int x_size, int y_size, int num_levels); int get_tex_shift(int orig_size);