Replies: 1 comment 11 replies
-
if you write it out to a file, can you then load it with stbi_load? if that corrupts in exactly the same way, please post that file. |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The NASA webite has fantastic 3D models of all nine planets, which I have downloaded. I am trying to develop a game for my 14 year old grandson where you fly a spaceship through the solar system. The models are downloaded in GLTF format, with a PNG file imbedded. I have successfully used cgltf.h to load all of the model data into memory, including the PNG file. I am trying to build an openGL texture file using stbi_load_from_memory. I'm calling it like this:
unsigned char* data = stbi_load_from_memory((unsigned char*)image, size, &width, &height, &channels, 0);
On return from the call, in which I do not get any error messages, data points to a buffer containing all xCC. Single stepping through the Visual Studio 2022 debugger, the buffer appears to get corrupted in stbi__parse_png_file, but I have been unable to trap the exact point. I know the PNG file is valid, because I can access the buffer and write it out to a file and then read it using Windows Photo viewer. All I'm looking for is some guidance on what could be wrong with the file in memory and perhaps what I could do about it.
Beta Was this translation helpful? Give feedback.
All reactions