diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-06-21 13:15:59 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-06-21 13:15:59 +0100 |
commit | 4e8c07d3fd949287fc2361284a5a7704e642396e (patch) | |
tree | 18d7e5c2d41cedb00a29ac303637102c7d4b157d /src/imageloader.cpp | |
parent | f3e75c7f821675740736b46094382d55c7e6ee5c (diff) | |
download | YAGE-4e8c07d3fd949287fc2361284a5a7704e642396e.tar.gz YAGE-4e8c07d3fd949287fc2361284a5a7704e642396e.zip |
Correcting indentation and removed vector2d.cpp
Diffstat (limited to 'src/imageloader.cpp')
-rw-r--r-- | src/imageloader.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/imageloader.cpp b/src/imageloader.cpp index 359d0af5..cca71844 100644 --- a/src/imageloader.cpp +++ b/src/imageloader.cpp @@ -9,37 +9,37 @@ namespace yage Texture ImageLoader::loadPng(const std::string &file_path) { - Texture texture = {}; + Texture texture = {}; - std::vector<unsigned char> in; - std::vector<unsigned char> out; - unsigned long width, height; + std::vector<unsigned char> in; + std::vector<unsigned char> out; + unsigned long width, height; - if(!IoManager::readFileToBuffer(file_path, in)) - throw std::runtime_error("Failed to load '"+file_path+"' to buffer"); + if(!IoManager::readFileToBuffer(file_path, in)) + throw std::runtime_error("Failed to load '"+file_path+"' to buffer"); - int error_code = decodePNG(out, width, height, &in[0], in.size()); - if(error_code != 0) - throw std::runtime_error("Failed to load '"+file_path+"' to png with error code"+std::to_string(error_code)); + int error_code = decodePNG(out, width, height, &in[0], in.size()); + if(error_code != 0) + throw std::runtime_error("Failed to load '"+file_path+"' to png with error code"+std::to_string(error_code)); - glGenTextures(1, &texture.id); + glGenTextures(1, &texture.id); - glBindTexture(GL_TEXTURE_2D, texture.id); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &out[0]); + glBindTexture(GL_TEXTURE_2D, texture.id); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &out[0]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glGenerateMipmap(GL_TEXTURE_2D); + glGenerateMipmap(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, 0); + glBindTexture(GL_TEXTURE_2D, 0); - texture.width = (int)width; - texture.height = (int)height; + texture.width = (int)width; + texture.height = (int)height; - return texture; + return texture; } } // yage |