- for(unsigned i=0; i<6; ++i)
- image(enumerate_faces(i), level, 0);
- }
-}
-
-void TextureCube::image(TextureCubeFace face, unsigned level, const void *data)
-{
- if(size==0)
- throw invalid_operation("TextureCube::image");
- if(level>=levels)
- throw out_of_range("TextureCube::image");
-
- unsigned lsz = get_level_size(level);
-
- if(ARB_texture_storage)
- return sub_image(face, level, 0, 0, lsz, lsz, data);
-
- if(!allocated)
- {
+ bind_scratch();
+ 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)
+ {
+ unsigned lv_size = get_level_size(i);
+ for(unsigned j=0; j<6; ++j)
+ glTexImage2D(get_gl_cube_face(static_cast<TextureCubeFace>(j)), i, gl_fmt, lv_size, lv_size, 0, comp, type, 0);
+ }