lightpreview: clear data before reloading

This commit is contained in:
Eric Wasylishen 2023-05-20 23:09:42 -06:00
parent c7985dad3e
commit c2f7cdbb7c
1 changed files with 9 additions and 0 deletions

View File

@ -63,6 +63,9 @@ GLView::~GLView()
m_indexBuffer.destroy();
m_vao.destroy();
lightmap_texture.reset();
m_drawcalls.clear();
doneCurrent();
}
@ -180,6 +183,12 @@ void GLView::renderBSP(const mbsp_t &bsp)
// we can only do this after `initializeGL()` has run once.
makeCurrent();
// clear old data
lightmap_texture.reset();
m_drawcalls.clear();
m_vbo.allocate(0);
m_indexBuffer.allocate(0);
// upload lightmap atlas
{
const auto &lm_tex = atlas.style_to_lightmap_atlas.at(0);