From ff24e4c604479fdcedfacca35af3bb4810683c68 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 17 Nov 2021 08:30:11 +0100 Subject: Image: fix bug where images are forced to be in RGBA format --- src/graphics/image.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/graphics/image.c') diff --git a/src/graphics/image.c b/src/graphics/image.c index 0a6a88a..eeee2ad 100644 --- a/src/graphics/image.c +++ b/src/graphics/image.c @@ -44,14 +44,12 @@ int mgl_image_load_from_file(mgl_image *self, const char *filepath) { self->height = 0; int format; - /* TODO: format is forced to rgba right now because rgb images cause the image to be skewed (bug) */ - self->data = stbi_load(filepath, &self->width, &self->height, &format, 4); + self->data = stbi_load(filepath, &self->width, &self->height, &format, 0); if(!self->data) { fprintf(stderr, "Error: failed to load image %s, error: %s\n", filepath, stbi_failure_reason()); mgl_image_unload(self); return -1; } - format = 4; self->format = stbi_format_to_mgl_image_format(format); return 0; @@ -65,14 +63,12 @@ int mgl_image_load_from_memory(mgl_image *self, const unsigned char *data, size_ self->height = 0; int format; - /* TODO: format is forced to rgba right now because rgb images cause the image to be skewed (bug) */ - self->data = stbi_load_from_memory(data, size, &self->width, &self->height, &format, 4); + self->data = stbi_load_from_memory(data, size, &self->width, &self->height, &format, 0); if(!self->data) { fprintf(stderr, "Error: failed to load image from memory, error: %s\n", stbi_failure_reason()); mgl_image_unload(self); return -1; } - format = 4; self->format = stbi_format_to_mgl_image_format(format); return 0; -- cgit v1.2.3