+ default_sampler.set_wrap_s(w);
+}
+
+void Texture::set_wrap_t(TextureWrap w)
+{
+ default_sampler.set_wrap_t(w);
+}
+
+void Texture::set_wrap_r(TextureWrap w)
+{
+ default_sampler.set_wrap_r(w);
+}
+
+bool Texture::can_generate_mipmap()
+{
+ return EXT_framebuffer_object;
+}
+
+void Texture::generate_mipmap()
+{
+ // glGenerateMipmap is defined here
+ static Require _req(EXT_framebuffer_object);
+
+ if(ARB_direct_state_access)
+ glGenerateTextureMipmap(id);
+ else
+ {
+ BindRestore _bind(this);
+ glGenerateMipmap(target);
+ }
+}
+
+void Texture::set_auto_generate_mipmap(bool gm)
+{
+ if(gm)
+ static Require _req(EXT_framebuffer_object);
+
+ auto_gen_mipmap = gm;
+}
+
+void Texture::set_compare_enabled(bool c)
+{
+ if(c)
+ default_sampler.set_compare(default_sampler.get_compare_function());
+ else
+ default_sampler.disable_compare();
+}
+
+void Texture::set_compare_func(Predicate f)
+{
+ default_sampler.set_compare(f);
+}
+
+void Texture::load_image(const string &fn, bool)
+{
+ load_image(fn, 0U);
+}
+
+void Texture::load_image(const string &fn, unsigned lv)
+{
+ Graphics::Image img;
+ img.load_file(fn);
+
+ image(img, lv);
+}
+
+void Texture::image(const Graphics::Image &img, bool)
+{
+ image(img, 0U);
+}
+
+void Texture::bind_to(unsigned i) const
+{
+ if(!id)
+ {
+ if(manager)
+ manager->resource_used(*this);
+ if(!id)
+ {
+ unbind_from(i);
+ return;
+ }
+ }
+
+ TexUnit &unit = TexUnit::get_unit(i);
+ const Texture *cur = unit.get_texture();
+ if(unit.set_texture(this))
+ {
+ if(manager)
+ manager->resource_used(*this);