diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index 695fda76e..aeb5069aa 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -185,8 +185,11 @@ inline Ref ExportData(Asset& a, std::string& meshName, Ref& bu unsigned int bytesPerComp = ComponentTypeSize(compType); size_t offset = buffer->byteLength; + // make sure offset is correctly byte-aligned, as required by spec + size_t padding = offset % bytesPerComp; + offset += padding; size_t length = count * numCompsOut * bytesPerComp; - buffer->Grow(length); + buffer->Grow(length + padding); // bufferView Ref bv = a.bufferViews.Create(a.FindUniqueID(meshName, "view"));