OBJParser - FAQs
  1. 1. Q: Why is the library binary so large?
  2. 2. Q: Is there any way I can reduce the binary size?
  3. 3. Q: Why did it fail to parse my file?
  4. 4. Q: Why did it fail to parse this line?
  5. 5. Q: How can I report a bug, crash, etc?

Q: Why is the library binary so large?

Update (7/16): Binaries generated by Visual Studio 2015 are significantly smaller than those generated by earlier versions (~20MB).

This is due to a number of reasons.

First, the library is built on top of Boost Spirit which is a very template heavy library. Fortunately, OBJParser isn’t quite as heavy as some other libraries that make use of Spirit.

Secondly, the OBJ and MTL formats are very unstructured. There is almost no regulations (aside from a few free-form statements) on when a statement may appear. This causes the grammar design to be generic, increasing some of the Spirit bloat.

Finally it is important to remember there are actually two parsers included in the library: one for .obj files, and one for .mtl files. And while the binary is large (~78MB on Windows), it is smaller than some other widely-used libraries (the largest of the Boost binaries is 85MB).

Q: Is there any way I can reduce the binary size?

Aside from cutting out support for statements you may not need (e.g. free-form curves/surfaces), there is no way I have found to do so. If you happen to find a solution, do let me know!

With that said, refactoring and refining of the grammar will continue which should lead to a reduction in binary size.

If the binary size is absolutely too large for your project, remember that OBJParser is open-source and you are free to use the code in any way you want. Remove statements, build as a DLL or inline with an executable, etc.

Q: Why did it fail to parse my file?

If parsing of an OBJ file failed, there are two ways to ascertain what went wrong.

First, the return value of OBJParser::parseOBJ will give a basic idea of what happened (failed to open file, failed to parse, etc.).

For a more detailed description of the error, a human-readable string can be retrieved via OBJParser::getLastError.

Q: Why did it fail to parse this line?

The parser fully supports the official format of both Wavefront OBJ and MTL files. Typically, a failed line parse is either due to an unsupported, unofficial statement, or due to an incorrectly formatted line.

A full list of supported statements (both official and unofficial) is available here.

Q: How can I report a bug, crash, etc?

Please see the contact information here.

If possible, please include relevant bits of the problem OBJ/MTL file(s), and any information available on the program that wrote them.