Fix high severity bug:

Vertex Buffer was deleted in model loading process
This commit is contained in:
4VRDriver
2020-09-15 11:29:32 +02:00
parent b957e4a5ee
commit 66ed52c575
4 changed files with 12 additions and 6 deletions

View File

@@ -23,7 +23,7 @@ void Model::draw(ShaderProgram *shaderProgram) {
// Iterate through every mesh and call the draw function
for(auto it = meshes.begin(); it != meshes.end(); it++) {
it->draw(shaderProgram);
(*it)->draw(shaderProgram);
}
}
@@ -98,7 +98,7 @@ void Model::loadModel(std::string pathToModel) {
meshTextures.push_back(loadedTextures[currentTextureId]);
}
Mesh currentMesh(meshVertices, meshIndices, meshTextures);
Mesh *currentMesh = new Mesh(meshVertices, meshIndices, meshTextures);
meshes.push_back(currentMesh);
}
}