Question

Quick question, how do i load a .obj modle into directx 11 (d3d11.h) and also the .mtl file for materials. Thanks in advance.

Was it helpful?

Solution

You can write your own parser, obj is a pretty simple text format (format description)

Otherwise some loaders already exists, like Assimp .It only deals with decoding, you will still need to create vertex/index buffers from decoded data.

OTHER TIPS

DirectX no longer comes with any libraries to load object files, such as *.obj, *.x and so on after version 9. You need to either download a library to open these files, or do it yourself since OBJ files are reasonably simple to parse.

See here for an example of this using OpenGL: http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Load_OBJ - the concepts should be reasonably easy to transition across.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top