gpt4 book ai didi

c - `stbi_failure_reason()` 不返回 SOI,但文件加载

转载 作者:行者123 更新时间:2023-12-05 06:14:37 25 4
gpt4 key购买 nike

我正在加载 png file使用 stb_image_load。代码看起来像

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!");

现在 stbi_failure_reason() 返回 no SOIpixels 不为空并完美加载纹理。 github 上关于此的第一个结果是关于格式错误的 png header ,所以我使用 pngcheck 检查,但它说 png 文件没问题。

知道为什么会这样吗?我也无法加载此 image但是,它适用于其他图像,有什么办法可以避免将来出现这种情况?

最佳答案

打开了一个问题 787为此,在较新的版本 (2.27) 上进行了修复

关于c - `stbi_failure_reason()` 不返回 SOI,但文件加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62807453/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com