diff --git a/LearnOpenGL/ResourceLoader.cpp b/LearnOpenGL/ResourceLoader.cpp index 8a3dc450cb9257891cc769f5337b849bf54dfa98..658066e9b8969f2401acb3e5206395c5ed4b22c9 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