views:

1831

answers:

4

I just want to know what file formats are the most OpenGL friendly in terms of loading and displaying inanimate textured 3d objects.

+2  A: 

.OBJ and .OFF are very popular, easy to parse and are human readable. There's not much a format can do to be "OpenGL friendly" but these two are quite decent.
.OFF is used to represent very basic geometry. point, normals, and faces and that's pretty much it.
.OBJ is more versatile and can store material information, division to pieces, various metadata and quite abit more.
If you're looking for more of a scene description language rather than object description, VRML is the obvious choice.

shoosh
I imported your .OFF suggestion into my post, it had a nice place there right under .raw; I hope you don't mind.
aib
Thanks for the links! The .OBJ link you gave is broken though. https://people.scs.fsu.edu/~burkardt/data/obj/obj.html
intrepion
+6  A: 

I was just looking at them today. There are many formats, and it's hard to choose among them.

There are a couple of questions that need to be answered before one can get to yours. What do you mean by "best"? Are you looking for something that's easy to parse? Are you looking to use 3rd party libraries? Do you want animation, textures, curves, bones, etc.?

  • Raw face data in a .raw file is the easiest. It contains a line for every triangle/quad in the scene, with 3x3 or 3x4 plain text floating point values to a line. Takes less than 10 lines of code to parse and display, but doesn't contain color, textures, shaders, animation or anything else.
  • The next step up is probably the DEC Object File Format (.OFF), as described in @Shy's post.
  • X3D, the successor of VRML seems like a nice open standard. It uses XML and can apparently get very complex, but there are a lot of tutorials and tools available out there.
  • DirectX' .x format is also easy to parse. It has a simple grammar, doesn't require an XML parser (though it may be a good idea to invest on writing or importing a good parser) and supports textures, animations, bones... It even prints your matrix values for you.

Then there are game-engine formats, some optimized for displaying a single model (like MD2, MD3) and some for large, open areas (game map formats.)

And then there are 3D editor-native formats that undoubtedly contain the most information but are also the hardest to parse.

Oh, and I just stumbled across this: Blender Wiki's File format list.

aib
Thanks for all the links.. I will continue to do more research on this!
intrepion
+1  A: 

I like .3ds files, they are relatively easy to read, can contain a fair amount of information, it is supported by most editors, and it's binary. But I usually use it mostly in the debugging phases of an application.

A much more robust and flexible format is Collada which is human readable and can contain more or less anything you would ever need.

+1  A: 

I would recommend .obj format since it is extremely simple to parse. Also, when you take lib3ds, reading .3ds files also becomes a piece of cake.

Ivan Vučica