You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
spnda
changed the title
gl_viewer out-of-bounds access on models without TEXCOORD_0 attribute
gl_viewer crashes on models without textures
Dec 11, 2023
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
The text was updated successfully, but these errors were encountered: