{
if(m)
set_manager(m);
- else if(ARB_direct_state_access)
- glCreateTextures(target, 1, &id);
else
- glGenTextures(1, &id);
+ generate_id();
}
Texture::~Texture()
glDeleteTextures(1, &id);
}
+void Texture::generate_id()
+{
+ if(id)
+ throw invalid_operation("Texture::generate_id");
+ if(ARB_direct_state_access)
+ glCreateTextures(target, 1, &id);
+ else
+ glGenTextures(1, &id);
+}
+
void Texture::set_format(PixelFormat fmt)
{
PixelComponents comp = get_components(fmt);
}
if(!texture.id)
- {
- if(ARB_direct_state_access)
- glCreateTextures(texture.target, 1, &texture.id);
- else
- glGenTextures(1, &texture.id);
- }
+ texture.generate_id();
texture.image(image, 0, true);
}