10 Texture1D::Texture1D():
11 Texture(GL_TEXTURE_1D),
17 void Texture1D::storage(PixelFormat fmt, unsigned wd)
20 throw invalid_operation("Texture1D::storage");
22 throw invalid_argument("Texture1D::storage");
23 require_pixelformat(fmt);
29 void Texture1D::allocate(unsigned level)
31 if(allocated&(1<<level))
34 image(level, get_base_pixelformat(ifmt), UNSIGNED_BYTE, 0);
37 void Texture1D::image(unsigned level, PixelFormat fmt, DataType type, const void *data)
40 throw invalid_operation("Texture1D::image");
42 unsigned w = get_level_size(level);
44 BindRestore _bind(this);
45 glTexImage1D(target, level, ifmt, w, 0, fmt, type, data);
47 allocated |= 1<<level;
48 if(gen_mipmap && level==0)
50 for(; w; w>>=1, ++level) ;
51 allocated |= (1<<level)-1;
55 unsigned Texture1D::get_level_size(unsigned level)
60 UInt64 Texture1D::get_data_size() const
62 return id ? width*get_pixel_size(ifmt) : 0;