Home

Awesome

Tiny glTF loader, header only C++ glTF 1.x parsing library.

TinyGLTFLoader is a header only C++ glTF 1.x https://github.com/KhronosGroup/glTF parsing library.

TinyGLTFLoader is deprecated. Please go https://github.com/syoyo/tinygltf for glTF 2.0 parser/serializer

Build Status

Build status

Features

Examples

TODOs

License

TinyGLTFLoader is licensed under MIT license.

TinyGLTFLoader uses the following third party libraries.

Build and example

Copy stb_image.h, picojson.h and tiny_gltf_loader.h to your project.

// Define these only in *one* .cc file.
#define TINYGLTF_LOADER_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#include "tiny_gltf_loader.h"

using namespace tinygltf;

Scene scene; 
TinyGLTFLoader loader;
std::string err;
  
bool ret = loader.LoadASCIIFromFile(scene, err, argv[1]);
//bool ret = loader.LoadBinaryFromFile(scene, err, argv[1]); // for binary glTF(.glb) 
if (!err.empty()) {
  printf("Err: %s\n", err.c_str());
}

if (!ret) {
  printf("Failed to parse glTF\n");
  return -1;
}

Running tests.

Setup

Python 2.6 or 2.7 required. Git clone https://github.com/KhronosGroup/glTF-Sample-Models to your local dir.

Run test

After building loader_example, edit test_runner.py, then,

$ python test_runner.py