PDA

View Full Version : How can I load model in OpenGL



hooknn
11-22-2005, 03:43 AM
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 :( thank u for your help. :confused:

11-22-2005, 04:50 AM
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. :)

Dan.

hooknn
11-22-2005, 05:29 AM
Thank you for your help.

11-22-2005, 10:00 AM
why the opengl wont work native with 3DS objects? or have a mesh files like .X in MSDirectX??

11-22-2005, 10:32 AM
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 :)

11-22-2005, 10:54 AM
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 :)

hooknn
11-22-2005, 05:12 PM
thank you guys

Rob The Bloke
11-24-2005, 06:12 AM
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.