Texture2D::Texture2D(ResourceManager *m):
Texture(GL_TEXTURE_2D, m),
+ ifmt(RGB),
width(0),
height(0),
allocated(0)
allocated |= 1<<level;
if(gen_mipmap && level==0)
{
+ auto_generate_mipmap();
for(; (w || h); w>>=1, h>>=1, ++level) ;
allocated |= (1<<level)-1;
}
return new AsyncLoader(*this, io);
}
+UInt64 Texture2D::get_data_size() const
+{
+ return id ? width*height*get_component_count(ifmt) : 0;
+}
+
void Texture2D::unload()
{
glDeleteTextures(1, &id);
id = 0;
+ // TODO check which params actually need refreshing
+ dirty_params = -1;
}
pixel_buffer(PIXEL_UNPACK_BUFFER),
mapped_address(0),
phase(0)
-{
- if(!texture.id)
- glGenTextures(1, &texture.id);
-}
+{ }
bool Texture2D::AsyncLoader::needs_sync() const
{
return false;
}
+ if(!texture.id)
+ glGenTextures(1, &texture.id);
texture.image(image, false, true);
}