summaryrefslogtreecommitdiff
path: root/gfx/models
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-01-26 21:15:46 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-01-26 21:15:46 +0000
commit0d7dd54f7b141229ec395b28a1f32013a65fd9ed (patch)
tree09edf86acb5ed3d48e4008935da5f840afae4859 /gfx/models
parentEnable alpha in textures (diff)
downloadilt-0d7dd54f7b141229ec395b28a1f32013a65fd9ed.tar.bz2
ilt-0d7dd54f7b141229ec395b28a1f32013a65fd9ed.tar.xz
ilt-0d7dd54f7b141229ec395b28a1f32013a65fd9ed.zip
Remove magic number and float flags from texture loader
Diffstat (limited to 'gfx/models')
-rw-r--r--gfx/models/texture.cpp6
1 files changed, 3 insertions, 3 deletions
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> 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);
}