- if(width==0)
- throw invalid_operation("Texture1D::image");
- if(level>=levels)
- throw out_of_range("Texture1D::image");
-
- if(ARB_texture_storage)
- return sub_image(level, 0, get_level_size(level), data);
-
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(target, id);
-
- image_(level, data);
-
- if(auto_gen_mipmap && level==0)
- {
- generate_mipmap_();
- allocated |= (1<<levels)-1;
- }
-
- glBindTexture(target, 0);
-}
-
-void Texture1D::image_(unsigned level, const void *data)
-{
- if(!allocated)
- {
- glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, levels-1);
- apply_swizzle();
- }
-
- PixelComponents comp = get_components(storage_fmt);
- GLenum type = get_gl_type(get_component_type(storage_fmt));
- glTexImage1D(target, level, storage_fmt, get_level_size(level), 0, comp, type, data);
-
- allocated |= 1<<level;
-}
-
-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);