I am loading a png file using stb_image_load. The code looks something like
stbi_uc* pixels = stbi_load("textures/viking_room.png", &texWidth, &texHeight, &texChannels, STBI_rgb_alpha);
...
if (stbi_failure_reason()) std::cout << stbi_failure_reason();
if (!pixels) throw std::runtime_error("failed to load texture image!");
Now stbi_failure_reason() return no SOI
but pixels
is not empty and loads the texture perfectly. The first result on github about this was about malformed png headers, so I checked using pngcheck, but it says that the png file is OK.
Any idea why this might be happening? I've also had trouble loading this image However it works with other images, is there any way I can avoid this in future?
There was an issue opened 787 for this and was fixed on a newer version (2.27)