From c2f7cdbb7ccc249ea9012f0c1e9fa46628dc8077 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 20 May 2023 23:09:42 -0600 Subject: [PATCH] lightpreview: clear data before reloading --- lightpreview/glview.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lightpreview/glview.cpp b/lightpreview/glview.cpp index d5a7ed0d..be760ec3 100644 --- a/lightpreview/glview.cpp +++ b/lightpreview/glview.cpp @@ -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);