Fix sprite texture not initially bound for new OSWindow

This commit is contained in:
Kovid Goyal 2017-11-16 16:55:22 +05:30
parent c4bcda80e9
commit d7ea28f8e7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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) {
// 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);
bound_texture_id = sprite_map.texture_id;
}
}
void