View Full Version : Data structure for OpenGL model data
What are the requirements for a good structure for storing model data? What sort of things need to be included, and where? Where should you store all the model data (vertices, faces, textures...)?
09-17-2002, 04:32 AM
Learn something about 3DS, ASE, MD2 or any else 3D Data storing files (there are many tutorials in Internet). These structures can give you an idea for your own structure, I hope that http://www.opengl.org/discussion_boards/ubb/wink.gif
09-17-2002, 01:05 PM
Here is what I recommend.
Start out with a class for a 3D point/vector. Give it only 3 data members for x,y,z, and no virtual functions. This will make it line up nicely in memory, and you can send it to OpenGl directly.
Then make a 3d object class. Give it vertices (an array of 3d point class instances), "faces" (an array of face class instances - this class should actually be a wrapper for the GL Primitives, like GL_TRIANGLES, GL_TRIANGLE_STRIP, etc. ), normals (another array of points), and texture coordinates (floating point array).
Take a look at my engine at http://home.earthlink.net/~ioquan for some ideas.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.