summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
author0undefined <oscar@nelin.dk>2025-06-13 22:48:46 +0000
committer0undefined <oscar@nelin.dk>2025-06-13 22:48:46 +0000
commit576f79c8ec877b62d55cc79493c0c2d660fde407 (patch)
tree8fe07ef2686da23acd3c45b39d1eac44afa52573 /src/resources
parentd0d3236687e265e6507a275fae506b17f2c85f6a (diff)
Use image components for GL texture loading
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/src/resources.c1
-rw-r--r--src/resources/src/textures.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/resources/src/resources.c b/src/resources/src/resources.c
index 52546db..6e35a4f 100644
--- a/src/resources/src/resources.c
+++ b/src/resources/src/resources.c
@@ -119,6 +119,7 @@ i32 resources_load(Resources *resources) {
case Asset_texture:
resources->texture[resources->texture_len] = load_texture(&resources->assets[i].texture);
resources->texture_len++;
+ LOG("Loaded texture \"%s\"!", resources->assets[i].texture.path);
break;
case Asset_error:
diff --git a/src/resources/src/textures.c b/src/resources/src/textures.c
index 7c205ef..2ba4691 100644
--- a/src/resources/src/textures.c
+++ b/src/resources/src/textures.c
@@ -23,12 +23,13 @@ Texture load_texture(const Asset_TextureSpec *restrict ts) {
}
img = stbi_load(ts->path, &width, &height, &components_per_pixel, 0);
+ ERROR("components per pixel: %d", components_per_pixel);
if (img == NULL) {
ERROR("Failed to load image %s", ts->path);
return err;
} else {
- t = createTextureFromImageData(img, width, height);
+ t = createTextureFromImageData(img, width, height, (u8)components_per_pixel);
stbi_image_free(img);
}