jkuhlmann/cgltf
Free:diamond_shape_with_a_dot_inside: Single-file glTF 2.0 loader and writer written in C99
About jkuhlmann/cgltf
cgltf is a single-file, stb-style C99 library for loading and writing glTF 2.0 files. It supports both glTF (JSON) and glb (binary) formats, including meshes, accessors, buffer views, buffers, materials, textures, samplers, images, scenes, nodes, skins, animations, cameras, morph targets, and extras data. The library also supports several glTF extensions such as EXT_mesh_gpu_instancing, EXT_meshopt_compression, EXT_texture_webp, and KHR_draco_mesh_compression (requires an external library). It is used in popular projects like bgfx, Filament, gltfpack, raylib, and Unigine. Loading can be done from file or memory, and writing is similarly supported. cgltf does not automatically load external buffer or image files; users must handle those or call cgltf_load_buffers for buffer data. The writer does not output external buffer or image data either.
Key Features
Pros & Cons
- Single-file header – easy to drop into any C/C++ project
- Supports a wide range of core glTF 2.0 features and popular extensions
- Lightweight and minimal dependencies (standard C library only)
- Proven in production by several well-known projects
- Both loading and writing are provided in a consistent API
- Does not automatically load external buffer or image files; user must handle file I/O or use helper functions
- Writer does not output external buffer or image data either
- Draco mesh compression support requires an external library
- Only supports glTF 2.0; no support for older glTF versions