Commit 9298d882 authored by Anakin's avatar Anakin

cleaning up before loading new stuff,

next step: calculate best first view position
parent 91b65bf6
......@@ -94,6 +94,7 @@ private:
// private functions
private:
void processInit();
void deleteVectors();
void startGLFW();
void createWindow();
......
......@@ -28,24 +28,7 @@ OpenGLController::~OpenGLController()
glDeleteTextures(1, &gluiSamplerID);
glfwTerminate();
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;
}
deleteVectors();
}
......@@ -124,6 +107,28 @@ void OpenGLController::processInit()
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()
{
if (!glfwInit())
......@@ -310,6 +315,9 @@ void OpenGLController::updateScene()
void OpenGLController::loadMsh(const char * path)
{
// clean up old stuff first
deleteVectors();
// get all models
try
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment