PDA

View Full Version : How to include self-modeled objects



RoBoT ZeRo
11-24-2001, 10:44 AM
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).

CU
RoBoT ZeRo

Morglum
11-25-2001, 04:07 AM
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.

Morglum

bignose
11-25-2001, 08:36 PM
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 www.righthemisphere.com (http://www.righthemisphere.com)

nemesis
11-25-2001, 11:46 PM
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.

dorbie
11-26-2001, 05:02 AM
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:
http://www.jawed.com/jawmd2/

RoBoT ZeRo
11-27-2001, 05:34 AM
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?

CU

RoBoT ZeRo

11-27-2001, 06:44 AM
>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.

--styx

Acid-Chris
11-27-2001, 09:07 AM
Hello!

try nehe.gamedev.net in one tutorial there is a milkshape model loading code...

regards,
- Christoph -