From 1fe271c3f60ec619bacf789ebdcd35be480950ba Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 7 Feb 2021 18:20:13 +0200 Subject: [PATCH] Fix sampler binding bug --- source/texture.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/texture.cpp b/source/texture.cpp index e6691b41..f6594ab1 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -226,6 +226,7 @@ void Texture::bind_to(unsigned i) const } TexUnit &unit = TexUnit::get_unit(i); + const Texture *cur = unit.get_texture(); if(unit.set_texture(this)) { if(manager) @@ -239,7 +240,7 @@ void Texture::bind_to(unsigned i) const glBindTexture(target, id); } - if(!unit.get_sampler()) + if(!unit.get_sampler() || unit.get_sampler()==&cur->default_sampler) default_sampler.bind_to(i); } } -- 2.45.2