Closed droettger closed 11 months ago
A crash does seem like unintended behaviour but I think what I was trying to do is require a model to have textures. The same applies for the code I wrote that you mentioned in #37.
The example wasn't made to cover absolutely every possibility and is only fairly rudimentary, but I will try and look into adding support for non-textured models, probably by adding a default white texture and just setting their vertex UVs to {0,0}
.
That would also simultaneously fix the issue with #37, so I'll close that issue and leave this open to track addition of a default texture to gl_viewer.
I seem to have misunderstood #37, and forgot that the shaders were written with non-textures in mind. So this issue was fairly trivial to fix. Thank you for mentioning this to me.
This line inside the gl_viewer example https://github.com/spnda/fastgltf/blob/main/examples/gl_viewer/gl_viewer.cpp#L421C3-L421C3 will crash with an out-of-bounds access inside the asset.accessors if
it->findAttribute("TEXCOORD_0")
returns it->attributes.end(). Happens with the Khronos model https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/BrainStem/glTF/BrainStem.gltf