Suppose a GLTF file provides a single N byte buffer which includes all vertex data for multiple meshes. The first m bytes are interleaved vertex positions, normals etc. for one geometry and the remaining data is non-interleaved data for other geometries. All meshes will be rendered eventually.

How is the data best uploaded to the GPU?

Is it best to upload the whole N bytes and then use vertexAttribPointer() to define the layout or is it better to upload the different buffer regions separately, one for each mesh? Or is there a benefit to separating the first m bytes of interleaved data from the remaining non-interleaved data? The overall footprint on the GPU would be the same.


It is slightly better to combine buffers since it reduces the amount of state that OpenGL has to track, which reduces memory usage overall, and helps reduce state changes.

But you only really get those benefits if you have a large number of these buffers floating around, on the order of thousands of them.

Usually it is better to go with whichever method best fits the code base that is supporting them since a simpler code base is easier to maintain, and will generally have less bugs. Then get fancy only if performance or memory constraints become an issue.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.