cleaning up before loading new stuff,

next step: calculate best first view position
This commit is contained in:
Anakin 2016-11-12 12:17:46 +01:00
parent 91b65bf6e3
commit 9298d88260
2 changed files with 27 additions and 18 deletions

View File

@ -94,6 +94,7 @@ private:
// private functions // private functions
private: private:
void processInit(); void processInit();
void deleteVectors();
void startGLFW(); void startGLFW();
void createWindow(); void createWindow();

View File

@ -28,24 +28,7 @@ OpenGLController::~OpenGLController()
glDeleteTextures(1, &gluiSamplerID); glDeleteTextures(1, &gluiSamplerID);
glfwTerminate(); glfwTerminate();
while (!vModels.empty()) deleteVectors();
{
Modl* cursor = vModels.back();
vModels.pop_back();
delete cursor->uv;
delete cursor->mesh;
delete cursor->vertex;
delete cursor;
}
while (!vTextures.empty())
{
textureData* cursor = vTextures.back();
vTextures.pop_back();
delete cursor->data;
delete cursor;
}
} }
@ -124,6 +107,28 @@ void OpenGLController::processInit()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
} }
void OpenGLController::deleteVectors()
{
while (!vModels.empty())
{
Modl* cursor = vModels.back();
vModels.pop_back();
delete cursor->uv;
delete cursor->mesh;
delete cursor->vertex;
delete cursor;
}
while (!vTextures.empty())
{
textureData* cursor = vTextures.back();
vTextures.pop_back();
delete cursor->data;
delete cursor;
}
}
void OpenGLController::startGLFW() void OpenGLController::startGLFW()
{ {
if (!glfwInit()) if (!glfwInit())
@ -310,6 +315,9 @@ void OpenGLController::updateScene()
void OpenGLController::loadMsh(const char * path) void OpenGLController::loadMsh(const char * path)
{ {
// clean up old stuff first
deleteVectors();
// get all models // get all models
try try
{ {