Object as list,array or function?

In a perfect world what is the best way to store an object? As an array, a display list,
a function, a header file or a better way?
What would be the most effecient one to use and make as a commom practice? The reason I’m asking is I gave my compiler a 72,000 line function for an object and the computer had a heart attack!

Originally posted by RobertSI:
In a perfect world what is the best way to store an object? As an array, a display list,
a function, a header file or a better way?
What would be the most effecient one to use and make as a commom practice? The reason I’m asking is I gave my compiler a 72,000 line function for an object and the computer had a heart attack!

Usually the best way is to load an object from a file format. Load in the file and store the data in either arrays, or your own structures. By doing this you don’t need to recompile your program to change the object.

When it comes to drawing it, compiling the object into a display list is the fastest way to draw it, but you cant manipulate it once compiled (you can’t employ any clipping of individual faces either - So you’d have to draw the whole object or not at all - very bad for large objects)

Vertex arrays are the next fastest, although these are somewhat fiddly when it comes to texturing. You can however play around with the vertex information. The only draw back is the lack of ability to share verticies etc, this will mean storing more data.

After that you are left with glBegin/glEnd and glVertex, glNormal etc. These are fully flexible and the easiest to use. They allow manipulation of data and the clipping of faces.

hope that was of some use…