Jump to content
  • Advertisement
Sign in to follow this  
DarkBalls

OpenGL 3d file format loader tutorial

This topic is 3405 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can anyone recommend a link that teaches how to load a 3ds and also md2 format for OpenGL? I want to understand everything behind it so I can include it on my own 3D engine. BTW, if you have any 3D book for opengl to recommend please include it here. Thanks, DarkBalls

Share this post


Link to post
Share on other sites
Advertisement
Here is a link to MD2 File format specifications.
Here is a link to the 3DS file format spec.

I would highly recommend that you use a third party library to import models into your engine because not all file formats are exported properly and cannot be loaded without a plethora of error checking. The one I use is the Asset Import library. It works with more then a dozen file formats including 3ds and md2.

Share this post


Link to post
Share on other sites
I think I don't need all the 3D file format. I heard that 3ds and md2 is good in games that's why I'll focus on those formats. But maybe I'll need that 3rd party library in the future so I'll bookmark it. Thank you very much RealMarkP.

By the way, I searched about md2 format and it says that its pretty old, md3 is new. Is it good for games? If not, what format is good? Do you know any tutorial for that?

And also, does 3ds max 2009 support md2 and md3? I"m planning to have a copy of that maybe tomorrow.

Thanks
DarkBalls

Share this post


Link to post
Share on other sites
3ds can be good or bad depending upon what you need it for. It can be used to store scene informations (like camera and lights) and not only models data. This is good because other popular formats like lwo or (IIRC) obj don't. But 3ds is also a very old format, with many limits, for example it can store only one texture per channel, and a limited amount of vertices/polygons per object (up to 65k IIRC). But most apps import from/export to 3ds.
I've also started using Assimp because this way I can choose among many formats, without writing importers for each one. Once I wrote a simple importer for 3ds: it was interesting, but too much work for what is generally not the main goal of your app.

Share this post


Link to post
Share on other sites
Quote:
Original post by DarkBalls
By the way, I searched about md2 format and it says that its pretty old, md3 is new. Is it good for games? If not, what format is good? Do you know any tutorial for that?

md2 was introduced in Quake 2, so it's over 11 years old. Since md3 was used for Quake 3 it's newer, but calling it "new" is a bit optimistic: it's becoming 10 this year. Your choice depends on what you want to achieve.

The good thing about md2 is that it's very easy to read and display, even for someone who's not (yet) an 3d wiz. It's doesn't use a skeleton animation as more recent formats, but stores all the vertex positions per frame. That, on the other hand, makes it impossible to change/modify/add new animations fast. It also keeps all vertex info as ints, resulting in "wobbly" animation.

A relatively recent format is the one used in the Doom 3 engine, md5. You can read up on it at http://tfc.duke.free.fr/coding/md5-specs-en.html, but it's rather advanced with quaternions and stuff.

Share this post


Link to post
Share on other sites
Quote:
Original post by DarkBalls
I think I don't need all the 3D file format. I heard that 3ds and md2 is good in games that's why I'll focus on those formats. But maybe I'll need that 3rd party library in the future so I'll bookmark it. Thank you very much RealMarkP.


I second using ASSIMP, unless of course you are trying to learn the details about loading the particular file formats. ASSIMP loads all of the supported formats into a single framework, so you only have to code one loading path and it will work for lots of different file types.

But if you are going the route of learning the details, the book Terrimus linked to is pretty good.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!