10 Texture1D::Texture1D():
11 Texture(GL_TEXTURE_1D),
16 void Texture1D::storage(PixelFormat fmt, unsigned wd)
19 throw invalid_operation("Texture1D::storage");
21 throw invalid_argument("Texture1D::storage");
22 require_pixelformat(fmt);
28 void Texture1D::allocate(unsigned level)
30 if(allocated&(1<<level))
33 image(level, get_base_pixelformat(ifmt), UNSIGNED_BYTE, 0);
36 void Texture1D::image(unsigned level, PixelFormat fmt, DataType type, const void *data)
39 throw invalid_operation("Texture1D::image");
41 unsigned w = get_level_size(level);
43 BindRestore _bind(this);
44 glTexImage1D(target, level, ifmt, w, 0, fmt, type, data);
46 allocated |= 1<<level;
47 if(gen_mipmap && level==0)
49 for(; w; w>>=1, ++level) ;
50 allocated |= (1<<level)-1;
54 unsigned Texture1D::get_level_size(unsigned level)