From 0d7dd54f7b141229ec395b28a1f32013a65fd9ed Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 26 Jan 2021 21:15:46 +0000 Subject: Remove magic number and float flags from texture loader --- gfx/models/texture.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gfx/models/texture.cpp') diff --git a/gfx/models/texture.cpp b/gfx/models/texture.cpp index 90ec016..bc80a1c 100644 --- a/gfx/models/texture.cpp +++ b/gfx/models/texture.cpp @@ -8,7 +8,7 @@ Cache Texture::cachedTexture; Texture::Texture(const std::string & fileName) : m_texture {} { int width, height, numComponents; - unsigned char * data = stbi_load((fileName).c_str(), &width, &height, &numComponents, 4); + unsigned char * data = stbi_load((fileName).c_str(), &width, &height, &numComponents, STBI_rgb_alpha); if (!data) { throw std::runtime_error {"Unable to load texture: " + fileName}; @@ -20,8 +20,8 @@ Texture::Texture(const std::string & fileName) : m_texture {} glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); stbi_image_free(data); } -- cgit v1.2.3