objects

Hey i’m trying to export objects from anim8or to c code so i can use them in my openGL program (written in C). Only problem is I get a huge array of vertices and i just don’t know how to use it to display the object on the screen. Anyone know how to do this?
Also, is there any place online where there are source code for objects written in c so that i can just include the header file and call the object with a function? (i would then do a scale and translation to put the objects where i want them on the screen).

Thanks.

I haven’t looked at the C code that Anim8or exports, but there are a couple of likely possibilities. Is there also an array of indices? If so, to draw the model, simply walk through the indicies, and use glVertex on the vertex that is at each of those indices. (Using GL_TRIANGLES most likely)

Code for this would look something like so…

glBegin(GL_TRIANGLES);
for (c=0;c<numIndices;c++)
{
glVertex3fv(vertices[indices[c]]);
}
glEnd();

If there is no index array, and it’s just an array of vertices, then you’d wanna do something like so…

glBegin(GL_TRIANGLES);
for (c=0;c<numIndices;c++)
{
glVertex3fv(vertices[c]);
}
glEnd();

That may vary a bit depending on exactly how vertices is stored. (i.e. a flat array vs. 2 dimensional array)