+void Texture1D::image(unsigned level, PixelComponents comp, DataType type, const void *data)
+{
+ if(comp!=get_components(format) || type!=get_component_type(format))
+ throw incompatible_data("Texture1D::image");
+ image(level, data);
+}
+
+void Texture1D::sub_image(unsigned level, int x, unsigned wd, const void *data)
+{
+ if(width==0)
+ throw invalid_operation("Texture3D::image");
+
+ Conditional<BindRestore> _bind(!ARB_direct_state_access, this);
+ allocate(level);
+
+ PixelComponents comp = get_components(storage_fmt);
+ DataType type = get_component_type(storage_fmt);
+ if(ARB_direct_state_access)
+ glTextureSubImage1D(id, level, x, wd, comp, type, data);
+ else
+ glTexSubImage1D(target, level, x, wd, comp, type, data);
+
+ if(auto_gen_mipmap && level==0)
+ generate_mipmap();
+}
+
+void Texture1D::sub_image(unsigned level, int x, unsigned wd, PixelComponents comp, DataType type, const void *data)
+{
+ if(comp!=get_components(format) || type!=get_component_type(format))
+ throw incompatible_data("Texture1D::sub_image");
+ sub_image(level, x, wd, data);
+}
+
+void Texture1D::image(const Graphics::Image &img, unsigned lv)
+{
+ if(img.get_height()!=1)
+ throw incompatible_data("Texture1D::image");
+
+ unsigned w = img.get_width();
+ PixelFormat fmt = pixelformat_from_image(img);
+ if(width==0)
+ storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w, lv);
+ else if(w!=width)
+ throw incompatible_data("Texture1D::image");
+
+ image(0, img.get_pixels());
+}
+
+unsigned Texture1D::get_n_levels() const
+{
+ unsigned n = 0;
+ for(unsigned s=width; s; s>>=1, ++n) ;
+ return n;
+}
+
+unsigned Texture1D::get_level_size(unsigned level) const