removed unused files,

removed unused functions,
removed unused variables,
reduced dynamic stack memory (there was too much allocated),
moved some code around into better place,
implemented destructor (there is still a std::_face_node left on the stack when the program is done),
This commit is contained in:
Anakin
2016-10-31 16:19:12 +01:00
parent ea07ead94f
commit a875820f48
8 changed files with 44 additions and 221 deletions

View File

@@ -6,9 +6,10 @@
#include <glm\gtc\matrix_transform.hpp>
#include "shader.hpp"
#include "import.h"
#include "Texture.h"
#include <iostream>
#define VERTEX_SHADER "Shader/VertexTextureShader.mv2shdr"
#define FRAGMENT_SHADER "Shader/FragmentTextureShader.mv2shdr"
//#define TEXTURE_NAME "Textures/texture32R.tga"
@@ -31,6 +32,17 @@ 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;
}
}
@@ -95,6 +107,27 @@ void OpenGLController::processInit()
// draw vertics only from one side
glEnable(GL_CULL_FACE);
// generate stuff
glGenVertexArrays(1, &gluiVertexArrayID);
glBindVertexArray(gluiVertexArrayID);
glGenBuffers(1, &gluiVertexBufferID);
glGenBuffers(1, &gluiUVBufferID);
// get the painter ready
try
{
gluiShaderPrgmID = LoadShaders(VERTEX_SHADER, FRAGMENT_SHADER);
}
catch (std::invalid_argument e)
{
MessageBox(NULL, e.what(), "MeshViewer 2.0 Error", MB_OK | MB_ICONERROR);
exit(1);
}
gluiMatrixID = glGetUniformLocation(gluiShaderPrgmID, "MVP");
gluiSamplerID = glGetUniformLocation(gluiShaderPrgmID, "textureSampler");
}
void OpenGLController::startGLFW()
@@ -266,38 +299,11 @@ void OpenGLController::updateScene()
void OpenGLController::loadMsh(const char * path)
{
// generate stuff
glGenVertexArrays(1, &gluiVertexArrayID);
glBindVertexArray(gluiVertexArrayID);
glGenBuffers(1, &gluiVertexBufferID);
glGenBuffers(1, &gluiUVBufferID);
try
{
gluiShaderPrgmID = LoadShaders(VERTEX_SHADER, FRAGMENT_SHADER);
}
catch (std::invalid_argument e)
{
MessageBox(NULL, e.what(), "MeshViewer 2.0 Error", MB_OK | MB_ICONERROR);
exit(1);
}
gluiMatrixID = glGetUniformLocation(gluiShaderPrgmID, "MVP");
gluiSamplerID = glGetUniformLocation(gluiShaderPrgmID, "textureSampler");
// get data
std::list<std::string> listTextures;
try
{
Object obj(path);
vModels = obj.getModels();
//vfVertices = obj.getVertex();
//vfUV = obj.getUV();
//listTextures = obj.getTexture();
//ui32MeshSize = obj.getSize();
}
catch (std::invalid_argument e)
{