I have the following function using stbi_load:
void load_texture_from_file(const char *file, bool alpha, const char *name) {
Texture *tex;
tex = malloc(sizeof(Texture));
tex->name = name;
int width, height, channels;
unsigned char *data = stbi_load(file, &width, &height, &channels, 0);
generate_texture(width, height, data, tex, alpha);
stbi_image_free(data);
}
File is coming from:
load_texture_from_file("/home/correct_folder/correct_name.png", true, "sprite");
I get no error using stbi_failure_reason() and when checking the contents of data with gdb I see:
Thread 1 "a" hit Breakpoint 2, load_texture_from_file (file=0x555555579d18 "/home/correct_folder/correct_name.png",
alpha=true, name=0x555555579d12 "face") at resource_manager.c:25
25 generate_texture(width, height, data, tex, alpha);
(gdb) print data
$1 = (unsigned char *) 0x7ffff40c1010 ""
What am I missing?