Arbitrary Object Rendering from a file

Greetings!

I am working on this virtual reality project and part of the specifications/requirements is to draw/render an arbitrary object in the VE that has its parameters set in an external file.

Ideally, the external file would be a text file that contains the vertices of the model, a house for example. When the text file is read by the program, the vertices are used to draw the house on the screen. However, I’ve been reading material and 3D drawings/models are not that simple to hold in a text file. It’s stored in an OBJ, MESH, 3DS, etc. but not a text file. So I would just like to know if this has already been done, loading information from a file of these type and then drawing the object in an OpenGL environment. If so, where do I start? :slight_smile:

OBJ and ASCII Mesh are text files, or to be more precise ASCII files. So, the idea is to use one of them. Furthermore, if you want to import drawing from CAD applications (because you have mentioned a house) then DXF is more suitable for that.

But my humble opinion is that COLLADA is the best for the purpose, although it an XML based file format (not plain text).

For all of these there are plenty free file loaders

Some useful links:

OBJ
http://sourceforge.net/projects/objloader/

3DS
http://code.google.com/p/lib3ds/

COLLADA
http://sourceforge.net/projects/colladaloader/

ASCII 3DS – A very old OpenGL loader/drawer
http://www.flipcode.com/archives/3DS_ASCII_Loader.shtml

Thank you very much :slight_smile:

You can also try the Assimp-Library at http://assimp.sourceforge.net/ , which is a multi-format-importer libs. It imports a big list of supported formats ( ASCII and binary, see http://assimp.sourceforge.net/main_features_formats.html for more informations ) into its generic format.
You can find a simple example how to use it with OpenGL as well.

Kimmi