How can I load model in OpenGL

I want to make a small game .And how can I load model in OpenGL.I don’t want just simple cubes,spheres in my game :frowning: thank u for your help. :confused:

It depends on what model format you want to load your model from (3DStudio, Lightwave, Gmax, etc).

The Alias Wavefront Object (.OBJ) is one of the easiest file formats to get started with, so you might want to take a look at that. Here’s a description of the file format:

http://www.robthebloke.org/source/obj.html

Or if you want to do something more complex, you might want to read a .3DS file. You can find libraries that will do this for you on the internet if you look hard enough.

Try a Google for ‘3DS library’ and see what you can find. :slight_smile:

Dan.

Thank you for your help.

why the opengl wont work native with 3DS objects? or have a mesh files like .X in MSDirectX??

You know, if someone were really motivated, he/she could put together a D3DX-like library. But the thing is, libraries like that sort of exist already. Like, you can find 3DS loaders online, including source code, like the one Dan mentioned. In fact, you can find most any file spec out there online. But I too think it would be nice to have them all in one place, especially when you’re starting out. Perhaps you would be kind enough to create one for us? That would make a lot of people very happy :slight_smile:

Another thought is that with XML gaining popularity, you may see Maya/3DS exporting to a common format (something like Colada) which means that loading model objects like this could be reduced to simply parsing an XML file in a common schema. This would eliminate the need for a bunch of different file formats, and make this stuff child’s play. I think this is likely to happen in the near future, at least I hope so :slight_smile:

thank you guys

problem with Colada though is that it outputs data primarily for the package that exported it, so you still need to do quite a bit of fiddling to get the data how you want it. Fbx is slightly better imho, and the SDK (available on Alias’s site) includes a demo viewer.