- 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);
-
- bind_scratch();
-
- if(!allocated)
- {
- glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, levels-1);
- apply_swizzle();
- }
-
- GLenum fmt = get_gl_pixelformat(storage_fmt);
- GLenum comp = get_gl_components(get_components(storage_fmt));
- GLenum type = get_gl_type(get_component_type(storage_fmt));
- glTexImage1D(target, level, fmt, get_level_size(level), 0, comp, type, data);
-
- allocated |= 1<<level;
+ return sub_image(level, 0, get_level_size(level), data);