From 8ab1d511f618dcfa245c388edf954ced555371a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=B1=EC=83=81=EC=88=98?= <shirostic@ajou.ac.kr> Date: Wed, 11 Dec 2019 03:09:25 +0900 Subject: [PATCH] fix openObj(). (brackets) --- LearnOpenGL/ResourceLoader.cpp | 42 ++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/LearnOpenGL/ResourceLoader.cpp b/LearnOpenGL/ResourceLoader.cpp index 8a3dc45..658066e 100644 --- a/LearnOpenGL/ResourceLoader.cpp +++ b/LearnOpenGL/ResourceLoader.cpp @@ -206,30 +206,32 @@ bool openObj(const std::string fileName, std::vector<glm::vec3> &vertices, std:: log_warn(infoLog, fileName + " : " + "faceVertexNormalIndices.size() : " + std::to_string(faceVertexNormalIndicies.size())); } } - - ifs.close(); - - return true; } - Image *load_Image(std::string fileName, int *width, int *height, int *nrChannels) - { - fileName = "../Images/" + fileName; - stbi_set_flip_vertically_on_load(true); + ifs.close(); - unsigned char *data = stbi_load(fileName.c_str(), width, height, nrChannels, 0); - if (data == NULL) - { - std::cout << "Failed to load texture : " + fileName << std::endl; - } + return true; +} - Image *img = new Image(*width, *height, *nrChannels, data); - return img; - } +Image *load_Image(std::string fileName, int *width, int *height, int *nrChannels) +{ + fileName = "../Images/" + fileName; + stbi_set_flip_vertically_on_load(true); - void free_image(Image *img) + unsigned char *data = stbi_load(fileName.c_str(), width, height, nrChannels, 0); + if (data == NULL) { - stbi_image_free(img->getData()); - free(img); - } \ No newline at end of file + std::cout << "Failed to load texture : " + fileName << std::endl; + } + + Image *img = new Image(*width, *height, *nrChannels, data); + + return img; +} + +void free_image(Image *img) +{ + stbi_image_free(img->getData()); + free(img); +} \ No newline at end of file -- GitLab