X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftexture.cpp;h=f6594ab14c7e5143434ac0823c862427c70f2c9d;hp=ab5700482ce02484efb7b960df00a9b3a95a0908;hb=bec07999d95b76f4b47cffcc564d0cd0afc0435e;hpb=635e5dc39adf09051bdacadbc402ddf22f7807a3 diff --git a/source/texture.cpp b/source/texture.cpp index ab570048..f6594ab1 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -28,6 +28,7 @@ Texture::Texture(GLenum t, ResourceManager *m): format(RGB8), storage_fmt(RGB8), swizzle(NO_SWIZZLE), + use_srgb_format(false), auto_gen_mipmap(false), default_sampler(*this) { @@ -225,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) @@ -238,7 +240,8 @@ void Texture::bind_to(unsigned i) const glBindTexture(target, id); } - default_sampler.bind_to(i); + if(!unit.get_sampler() || unit.get_sampler()==&cur->default_sampler) + default_sampler.bind_to(i); } } @@ -260,6 +263,9 @@ void Texture::unbind_from(unsigned i) unit.bind(); glBindTexture(cur->target, 0); } + + if(unit.get_sampler()==&cur->default_sampler) + Sampler::unbind_from(i); } }