Fix memory bug.

This commit is contained in:
Syoyo Fujita
2016-05-25 19:48:25 +09:00
parent 2c7ba7b2ab
commit 5f4a557d69
2 changed files with 7 additions and 4 deletions

View File

@@ -214,11 +214,11 @@ const char* get_file_data(size_t *len, const char* filename)
bool LoadObjAndConvert(float bmin[3], float bmax[3], const char* filename, int num_threads)
{
#if 0
#if 1
std::vector<float, lt::allocator<float>> vertices;
std::vector<float, lt::allocator<float>> normals;
std::vector<float, lt::allocator<float>> texcoords;
std::vector<int, lt::allocator<vertex_index>> faces;
std::vector<vertex_index, lt::allocator<vertex_index>> faces;
size_t data_len = 0;
const char* data = get_file_data(&data_len, filename);
@@ -529,11 +529,15 @@ int main(int argc, char **argv)
Init();
std::cout << "Initialize GLFW..." << std::endl;
if(!glfwInit()){
std::cerr << "Failed to initialize GLFW." << std::endl;
return -1;
}
std::cout << "GLFW OK." << std::endl;
window = glfwCreateWindow(width, height, "Obj viewer", NULL, NULL);
if(window == NULL){
@@ -561,6 +565,7 @@ int main(int argc, char **argv)
float bmin[3], bmax[3];
if (false == LoadObjAndConvert(bmin, bmax, argv[1], num_threads)) {
printf("failed to load & conv\n");
return -1;
}