cleaning up before loading new stuff,
next step: calculate best first view position
This commit is contained in:
parent
91b65bf6e3
commit
9298d88260
|
@ -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();
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue