View Full Version : Importing models

05-30-2002, 07:27 PM
I have seen asked quite often, how do I open 3d studio files in openGL. The answer is usually go read the file format spec and write yourself an importer.
While I think thats harsh, I can deal.
What I would like to know, and I think everyone else (well us newbies) are wondering is what type of structure do we load them into?
Is display lists the right way to go? I heard that if you have a very complex model these might be bad for some reason. Any pros or cons? Thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

05-31-2002, 01:39 AM
I think that for static models disp. lists are the way to go.As for importing 3ds files, there's a spec at www.whotsit.org (http://www.whotsit.org) w/ source code which reads the file and prints out vertex/face/etc. info.It should be pretty simple to put it in a disp. list instead of printing it out/

06-01-2002, 12:50 PM
Ah great.
What would you use for non static models then? Is this the model class in openGL?
Thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

Rob The Bloke
06-01-2002, 02:37 PM
Originally posted by Roadmaster:
Ah great.
What would you use for non static models then?

Usually vertex arrays are used for non-static models because they are quick and you can change the data in them. Generally display lists in addition can also be used. For example, if you set up a character that uses hierarchical animation, you can make static things such as guns etc use display lists and then use vertex arrays for everything else.

Rob The Bloke
06-01-2002, 02:38 PM
oh yeah,

it's www.wotsit.org (http://www.wotsit.org)

06-02-2002, 12:21 AM
However, you can use a library to do all the work for you. I use Lib3DS to import my 3DS models. Look it up at

06-02-2002, 07:33 AM
Arguably the most legible code for Visual C++/MFC newbies is Display3DS (http://p-squared.com/Display3DS.zip) which decodes and displays 3DS files quickly and easily while forming a minimalist basis for their own mods.

06-02-2002, 12:26 PM
Does anyone know how to interpret the smoothing information in 3ds files properly.

All the source code I've seen calculates the normals checking the angle between adjacent triangles.

I made a school project to import 3ds files and my algorithm was slow as hell, so I've never tested it properly http://www.opengl.org/discussion_boards/ubb/smile.gif. With a little time (2 months!) I actually got it to work faster but in no way I checked if it was working properly for all cases (it works for teapots so probably it's near good).

Since I've never stopped thinking about it, I'd hope someone has a better understanding of it!

06-02-2002, 06:24 PM
Awesome thanks for all the replies so far.
I think I'm going to start simple and work my way up http://www.opengl.org/discussion_boards/ubb/smile.gif

06-03-2002, 08:26 PM
I use Milkshape3d....not sure if you like that or not but its $20 and easy to load stuff and it does animation/skeleton stuff and works good I think. I pretty new with OpenGL and stuff but I think you can convert 3ds files into milkshape files with Milkshape3d.

I know you can get Half Life 3d models and convert them, same with Quake.

06-03-2002, 08:56 PM
Does anyone know of a tutorial or even a spec for how animations are stored in a regular milkshape file? Theres a tutorial at NeHe's but it doesn't cover animation, just loading the vertex's.
Many thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

06-03-2002, 09:08 PM
try www.gametutorials.com (http://www.gametutorials.com) // i think thats the url do a seacrh for that + opengl 3ds + u should find it