From: Mikko Rasa Date: Tue, 2 Nov 2021 11:36:06 +0000 (+0200) Subject: Avoid incorrect access to VertexSetup while async loading Mesh X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=8092f757684a97e338794525b52a1154bd996e0e;p=libs%2Fgl.git Avoid incorrect access to VertexSetup while async loading Mesh --- diff --git a/source/core/mesh.cpp b/source/core/mesh.cpp index 07e5e27f..467f3544 100644 --- a/source/core/mesh.cpp +++ b/source/core/mesh.cpp @@ -29,6 +29,8 @@ void Mesh::storage(const VertexFormat &fmt) vertices.set_format(fmt); vtx_setup.set_format(fmt); + if(vbuf) + vtx_setup.set_vertex_array(vertices); } void Mesh::clear() @@ -47,7 +49,8 @@ void Mesh::check_buffers(unsigned mask) delete vbuf; vbuf = new Buffer; vertices.use_buffer(vbuf); - vtx_setup.set_vertex_array(vertices); + if(!vertices.get_format().empty()) + vtx_setup.set_vertex_array(vertices); dirty |= VERTEX_BUFFER; #ifdef DEBUG