- levels = min(levels, lv);
-
- GLenum gl_fmt = get_gl_pixelformat(storage_fmt);
- if(ARB_texture_storage)
- {
- if(ARB_direct_state_access)
- glTextureStorage1D(id, levels, gl_fmt, width);
- else
- {
- bind_scratch();
- glTexStorage1D(target, levels, gl_fmt, width);
- }
- }
- else
- {
- bind_scratch();
- glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, levels-1);
- GLenum comp = get_gl_components(get_components(storage_fmt));
- GLenum type = get_gl_type(get_component_type(storage_fmt));
- for(unsigned i=0; i<levels; ++i)
- glTexImage1D(target, i, gl_fmt, get_level_size(i), 0, comp, type, 0);
- }