Page 1 of 1
OBJ Loader
Posted: Sun Apr 24, 2011 6:27 pm
by like80ninjas
Okay, I'm looking for someone to help me write a simple obj loader in c++. I have been scouring the interwebs searching for something, but I have either had errors compiling or the ones I did get to work correctly just had too many features I didn't need. ( For example GLM had a bunch of error handling that would shut down the program at the mere sight of a screw up ). So I went on to attempt to write my own, which failed miserably. All I want to be able to do is load .obj models, while being able to load their textures and materials into a model class, where each instance of the model class would account for a mesh and material/texture.
Re: OBJ Loader
Posted: Mon Apr 25, 2011 1:17 pm
by cypher1554R
What are you using to render them with?
If you're using DirectX, there is a good example in the SDK examples folder.
Re: OBJ Loader
Posted: Mon Apr 25, 2011 2:15 pm
by like80ninjas
Sorry, it's c++ and opengl.
Re: OBJ Loader
Posted: Mon Apr 25, 2011 2:59 pm
by Boogy
Have you checked
Wikipedia?
The OBJ format isn't that hard to understand.
If you want I can make a small tutorial on how to easily load an .obj file.
Re: OBJ Loader
Posted: Mon Apr 25, 2011 3:01 pm
by like80ninjas
Yes, I have. As I mentioned in the original post, I attempted to create my own by parsing the file but it failed. I think it failed somewhere near the actual putting together of the polygons(triangles). Yes it would help to have a tutorial.
Re: OBJ Loader
Posted: Mon Apr 25, 2011 3:20 pm
by Boogy
like80ninjas wrote:Yes, I have. As I mentioned in the original post, I attempted to create my own by parsing the file but it failed. I think it failed somewhere near the actual putting together of the polygons(triangles). Yes it would help to have a tutorial.
If I have some spare time tomorrow I might put together a small tutorial.
The faces are defined with index numbers
The first vertex of the polygon points to the fourth element in the vertex list. (these start with
v)
The second vertex points to the second index in the vertex list and the third vertex points to the sixth element in the vertex list.
Note: OBJ starts counting arrays from 1 and not 0 so in c++ you have to subtract one from the index numbers.
Re: OBJ Loader
Posted: Mon Apr 25, 2011 3:25 pm
by like80ninjas
I knew about the way f v v v works, but I didn't know that it starts from 1 instead of 0. A tutorial would be great help!
Re: OBJ Loader
Posted: Wed Apr 27, 2011 7:09 pm
by gamenovice
I would also likea tutorial on obj :D
Re: OBJ Loader
Posted: Thu Apr 28, 2011 2:36 pm
by Boogy
gamenovice wrote:I would also likea tutorial on obj :D
I'll get started then :P
Re: OBJ Loader
Posted: Thu Apr 28, 2011 4:04 pm
by Boogy
Boogy wrote:gamenovice wrote:I would also likea tutorial on obj :D
I'll get started then :P
I have finished writing a small obj loader in c++ together with OpenGL.
Now I only need to explain how it works
Re: OBJ Loader
Posted: Thu Apr 28, 2011 4:07 pm
by Zer0XoL
Re: OBJ Loader
Posted: Thu Apr 28, 2011 7:50 pm
by like80ninjas
Thanks for the link, but like I said in the main post, I'm not interested in the amount overhead GLM uses. It was really annoying.