save and restore layers image when context is lost in Android
This commit is contained in:
@@ -27,6 +27,10 @@ Texture2D& TextureManager::get(uint16_t id)
|
||||
|
||||
void TextureManager::invalidate()
|
||||
{
|
||||
for (auto& t : m_textures)
|
||||
{
|
||||
t.second.destroy();
|
||||
}
|
||||
m_textures.clear();
|
||||
}
|
||||
|
||||
@@ -37,6 +41,7 @@ bool Texture2D::create(int width, int height, GLint internal_format, GLint forma
|
||||
m_format = format;
|
||||
m_iformat = internal_format;
|
||||
glGenTextures(1, &m_tex);
|
||||
LOG("genTex %d", m_tex);
|
||||
bind();
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, GL_UNSIGNED_BYTE, data);
|
||||
unbind();
|
||||
@@ -60,6 +65,7 @@ void Texture2D::assign(GLuint tex, int w/* = -1*/, int h/* = -1*/, GLuint intern
|
||||
|
||||
bool Texture2D::load(std::string filename)
|
||||
{
|
||||
LOG("load texture %s", filename.c_str());
|
||||
ui::Image img;
|
||||
if (!img.load(filename))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user