]> git.tdb.fi Git - libs/gl.git/commitdiff
Avoid incorrect access to VertexSetup while async loading Mesh
authorMikko Rasa <tdb@tdb.fi>
Tue, 2 Nov 2021 11:36:06 +0000 (13:36 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 2 Nov 2021 13:11:17 +0000 (15:11 +0200)
source/core/mesh.cpp

index 07e5e27f928f41911e3ca376850e3fd4ed081c62..467f35448382e4d02744cbc3a6ccf36fef657984 100644 (file)
@@ -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