Obj Loader for Opengl + Glut
I'm Working on a Game for Open Gl, and I Want to Simply Be Able to Load Obj Files, with Their Textures into My Game. I Want the Loader to Contain All the...
I'm working on a game for open GL, and I want to simply be able to load OBJ files, with their textures into my game. I want the loader to contain all the necessary code to map the textures to the object.
(Note I have scoured google, and not one example I've seen has been simple enough to bolt onto my currently existing code, I'm talking 2 headers, and 2 cpps maximum)
Could anybody provide me with one?
2 Answers
you could get started by this simple loader which loads objects in a wavefront .obj file into a OpenGL scene. This code restricts to just scanning the vertex information out of OBJ. You could enhance it further may be after getting the basic idea.
You can find mine at:
It's a pretty simple one, but clean.
you will only need the Model class, which will load an OBJ file by filename:
You may need to remove some things to make it fit on your project. Namely the dependency to ResourceManager which loads the textures and return their id, but that should not be much work.
Hope it helps.