How to include self-modeled objects

Yo guys,
Although I only know how to create a window, i would like to know how you can include an object you’ve created in a modeler (like Milkshape).

RoBoT ZeRo

Well, you export it to any file format you’re able to load. The most ommonly used file formats are .3ds and .ase. You could easily download loaders, but I prefer writing my own.


3D Exploration will import most 3D file formats, and export C++ OpenGL code which you can then paste into your program. Very cool, but a little pricey.

I think their website is

Usually, people export 3D meshes to an ASCII file format, as Morglum said, such as .3DS or .ASE.
Then you have to parse the file getting the info you need to draw it in your OpenGL environment.

You save the object as some kind of file format you can understand. You then read the format to your application’s memory space, probably manipulating it to something that suits your needs, perhaps computing surface normals or bound boxes if required. Next you draw this internal memory representation as OpenGL primitives, like triangle meshes.

There are libraries and sample code you might be able to link to to help you parse a particular file format and draw it in OpenGL, but they all basically implement one or more of the steps I’ve described.

Here is some sample code which might help you start development with simple Quake models so you can understand this process:

I don’t know if you understood my question.

I want to include a tree for instance, which i’ve modeled in milkshape.

What should the code be?


RoBoT ZeRo

>I don’t know if you understood my question.

actually they understood your question.
you either take a free loader to load the data into arrays/structures and then draw it via opengl, or you write your own load to do the same.
such a loader is not something that can be posted in a snippet of code on such a board.



try in one tutorial there is a milkshape model loading code…


  • Christoph -