From d7ea28f8e753fced90ab22a9978bf48ff7d97cbe Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 16 Nov 2017 16:55:22 +0530 Subject: [PATCH] Fix sprite texture not initially bound for new OSWindow --- kitty/shaders.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/kitty/shaders.c b/kitty/shaders.c index 6b0c8bce0..09247807c 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -78,13 +78,11 @@ realloc_sprite_texture() { static inline void ensure_sprite_map() { - static GLuint bound_texture_id = 0; if (!sprite_map.texture_id) realloc_sprite_texture(); - if (bound_texture_id != sprite_map.texture_id) { - glActiveTexture(GL_TEXTURE0 + SPRITE_MAP_UNIT); - glBindTexture(GL_TEXTURE_2D_ARRAY, sprite_map.texture_id); - bound_texture_id = sprite_map.texture_id; - } + // We have to rebind since we dont know if the texture was ever bound + // in the context of the current OSWindow + glActiveTexture(GL_TEXTURE0 + SPRITE_MAP_UNIT); + glBindTexture(GL_TEXTURE_2D_ARRAY, sprite_map.texture_id); } void