I'm looking for a faster solution that will allow me to load objects faster with OpenGL and currently when trying to load, parse and pass the data on my main thread it takes a while... Would multi-threading be a reasonable solution to this and if so, how would I go about it?

Would I make a second thread with the same context and save the data once it has loaded or...

Would I create a second thread to load and parse the data, then pass it back to the first thread to save to the GPU?

This is the limit of my knowledge of this subject at the minute, if anyone has any better solutions please drop me a comment.

  • \$\begingroup\$ It's pretty hard to suggest something better without any clue as to what you're doing for now... \$\endgroup\$
    – Quentin
    Commented Dec 2, 2016 at 13:36

1 Answer 1


You've mentioned "parse the data" a few times, which suggests to me that you're probably using .obj files; even if not, the fact that you have to parse data is sufficient.

The fastest work is the work that you don't have to do at all. Parsing data can be slow; parsing, interpreting, converting and validating plain text data from a .obj file is even slower.

The fastest model loading consists of the following steps:

  • Memory-map the model file.
  • Read and interpret a lightweight header to get basic info such as size, number of frames, etc.
  • Pass the data pointer into a glBufferData call.
  • Done.

With this kind of setup there is no parsing at all, there is no shuffling data around between multiple intermediate buffers, the model data goes directly into a VBO and is already in the format that GL will use it in.

There are some things that you can infer from all of this.

  • Don't use .obj files.
  • Prefer binary data over plain text data.
  • Don't use .obj files.
  • Keep your data in as close to the format that GL will consume it in as possible.
  • Don't use .obj files.
  • Move data between as few intermediate buffers as possible.
  • Don't use .obj files.

Not using .obj files probably deserves some further discussion, particularly since you will frequently see them used in tutorials. .obj files are actually fine for tutorials, they're fine as an intermediate format and they're fine as an interchange format. What they're not fine as is a final format optimized for fast loading.

  • 1
    \$\begingroup\$ You forgot "Don't use .obj files". Even worse are XML based files. Wavefront at least only puts in the data that's necessary. \$\endgroup\$
    – Bálint
    Commented Dec 2, 2016 at 16:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .