jkuhlmann / cgltf

:diamond_shape_with_a_dot_inside: Single-file glTF 2.0 loader and writer written in C99
MIT License
1.44k stars 136 forks source link

cgltf_load_buffer_base64 returns cgltf_result_io_error for what seems to valid base64 #171

Closed abbaswasim closed 2 years ago

abbaswasim commented 2 years ago

I have been using this cgltf_load_buffer_base64 to decode images from Khronos glTF samples repo. Images in some of the embedded glTF files like DamagedHelmet and TextureCoordinateTest can't be decoded using cgltf_load_buffer_base64.

Surprisingly If I just copy past the base64 data from the glTF file into https://www.base64decode.org it also complains but then https://gltf-viewer.donmccurdy.com happily accepts the file and loads the models correctly.

At this point I am not sure if its actually cgltf_load_buffer_base64 that doesn't know this specific encoding or gltfviewer doing some magic that makes it work. I thought I should ask perhaps you know more.

abbaswasim commented 2 years ago

Never mind apologies this has been a dumb driver issue. I wasn't calculating the size correctly. https://www.base64decode.org put me off though, it doesn't take size it calculates it itself...