diff options
author | Syoyo Fujita <syoyo@lighttransport.com> | 2016-05-25 19:48:25 +0900 |
---|---|---|
committer | Syoyo Fujita <syoyo@lighttransport.com> | 2016-05-25 19:48:25 +0900 |
commit | 5f4a557d693b7b6cc9eb4afd737e3625a2112580 (patch) | |
tree | 55fc8a1fb9c64df45715bc6b86cb7b98260742bd /experimental | |
parent | 2c7ba7b2ab5af011859020f2bc228ef14eeda65b (diff) | |
download | tinyobjloader-5f4a557d693b7b6cc9eb4afd737e3625a2112580.tar.gz |
Fix memory bug.
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/optimized-parse.cc | 2 | ||||
-rw-r--r-- | experimental/viewer.cc | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/experimental/optimized-parse.cc b/experimental/optimized-parse.cc index 01df737..5f7ae93 100644 --- a/experimental/optimized-parse.cc +++ b/experimental/optimized-parse.cc @@ -273,8 +273,6 @@ static inline int length_until_newline(const char *token, int n) { int len = 0; - assert(n < 4095); - // Assume token[n-1] = '\0' for (len = 0; len < n -1; len++) { if (token[len] == '\n') { diff --git a/experimental/viewer.cc b/experimental/viewer.cc index e9402be..36d9ee9 100644 --- a/experimental/viewer.cc +++ b/experimental/viewer.cc @@ -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; } |