OBJ Loader
Moderator: Coders of Rage
-
- Chaos Rift Regular
- Posts: 101
- Joined: Thu Dec 09, 2010 2:13 am
OBJ Loader
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.
- cypher1554R
- Chaos Rift Demigod
- Posts: 1124
- Joined: Sun Jun 22, 2008 5:06 pm
Re: OBJ Loader
What are you using to render them with?
If you're using DirectX, there is a good example in the SDK examples folder.
If you're using DirectX, there is a good example in the SDK examples folder.
-
- Chaos Rift Regular
- Posts: 101
- Joined: Thu Dec 09, 2010 2:13 am
Re: OBJ Loader
Sorry, it's c++ and opengl.
- Boogy
- Chaos Rift Newbie
- Posts: 27
- Joined: Sun Mar 06, 2011 3:59 pm
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Location: Breda, The Netherlands
- Contact:
Re: OBJ Loader
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.
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.
Student @ IGAD
-
- Chaos Rift Regular
- Posts: 101
- Joined: Thu Dec 09, 2010 2:13 am
Re: OBJ Loader
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.
- Boogy
- Chaos Rift Newbie
- Posts: 27
- Joined: Sun Mar 06, 2011 3:59 pm
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Location: Breda, The Netherlands
- Contact:
Re: OBJ Loader
If I have some spare time tomorrow I might put together a small tutorial.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.
The faces are defined with index numbers
Code: Select all
f 4 2 6
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.
Student @ IGAD
-
- Chaos Rift Regular
- Posts: 101
- Joined: Thu Dec 09, 2010 2:13 am
Re: OBJ Loader
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!
- gamenovice
- Chaos Rift Cool Newbie
- Posts: 78
- Joined: Fri Nov 12, 2010 7:49 pm
- Current Project: wii u dev, sdl, and some unity 3D
- Favorite Gaming Platforms: PC, GAMEBOY, GAMECUBE, WII, 3DS,PS2
- Programming Language of Choice: C#,C++,Java
- Location: Tampa,FL
- Contact:
Re: OBJ Loader
I would also likea tutorial on obj :D
without code, we wouldnt have life as we know it...
- Boogy
- Chaos Rift Newbie
- Posts: 27
- Joined: Sun Mar 06, 2011 3:59 pm
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Location: Breda, The Netherlands
- Contact:
Re: OBJ Loader
I'll get started then :Pgamenovice wrote:I would also likea tutorial on obj :D
Student @ IGAD
- Boogy
- Chaos Rift Newbie
- Posts: 27
- Joined: Sun Mar 06, 2011 3:59 pm
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Location: Breda, The Netherlands
- Contact:
Re: OBJ Loader
I have finished writing a small obj loader in c++ together with OpenGL.Boogy wrote:I'll get started then :Pgamenovice wrote:I would also likea tutorial on obj :D
Now I only need to explain how it works
Student @ IGAD
-
- Chaos Rift Regular
- Posts: 101
- Joined: Thu Dec 09, 2010 2:13 am
Re: OBJ Loader
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.