- 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");
-
- unsigned s = get_level_size(level);
- if(s==0)
- throw out_of_range("TextureCube::image");
-
- if(ARB_texture_storage)
- return sub_image(face, level, 0, 0, s, s, data);
-
- BindRestore _bind(this);
-
- if(!allocated)
- {
- glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, levels-1);
- apply_swizzle();
- }
-
- PixelComponents comp = get_components(storage_fmt);
- GLenum type = get_gl_type(get_component_type(storage_fmt));
- glTexImage2D(face, level, storage_fmt, s, s, 0, comp, type, data);
-
- if(level==0)
- {
- allocated |= 1<<get_face_index(face);
- if((allocated&63)==63)
+ 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)