+void Texture1D::sub_image(unsigned level, int x, unsigned wd, PixelFormat fmt, DataType type, const void *data)
+{
+ if(width==0)
+ throw invalid_operation("Texture3D::image");
+
+ Conditional<BindRestore> _bind(!ARB_direct_state_access, this);
+ allocate(level);
+
+ fmt = get_upload_format(fmt);
+ if(ARB_direct_state_access)
+ glTextureSubImage1D(id, level, x, wd, fmt, type, data);
+ else
+ glTexSubImage1D(target, level, x, wd, fmt, type, data);
+
+ if(auto_gen_mipmap && level==0)
+ generate_mipmap();
+}
+
+void Texture1D::image(const Graphics::Image &img, bool srgb)
+{
+ if(img.get_height()!=1)
+ throw incompatible_data("Texture1D::image");
+
+ unsigned w = img.get_width();
+ PixelFormat fmt = pixelformat_from_graphics(img.get_format());
+ if(width==0)
+ {
+ unsigned l = (is_mipmapped(min_filter) ? mipmap_levels ? mipmap_levels : 0 : 1);
+ storage(storage_pixelformat_from_graphics(img.get_format(), srgb), w, l);
+ }
+ else if(w!=width)
+ throw incompatible_data("Texture1D::image");
+
+ image(0, fmt, UNSIGNED_BYTE, img.get_data());
+}
+
+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