ge2 vertices order

I am trying to load a .ge2 file generated by maya into opengl. I have no problem parsing it, however I can not figure out the order in which the file stores an object’s coordinates. What order and in what gl type do I need to render the object’s coordinates with? Thank you for your time.

My first hit on google…
http://www.codeproject.com/useritems/ge2loader.asp

I’ve read that page before (I actually Google everything first before I ask). The app that he made that you can download only parses and stores the vertices, it does not render the object. Maybe I just don’t get what he is saying but I don’t understand what order to render the vertices. I read them in order and tried to pass them through a vertex array using triangle strips, normal triangles, etc., but had no luck. So my question is, what order do you render the vertices and in what format (ie, triangle strip).

I’m not helping much, but a while back I’ve tried loading some 3ds max files for opengl. The thing I noticed after some failed attempts to render the object correctly was that the object did not have only one type of polygon. It had quads, triangles, maybe even strips (I noticed it after loading the models in 3ds max which rendered them correctly). So my suggestions is that each “chunk” probably includes information on the type of polygons it has. If you are able to read these (I wasn’t, didn’t try as much), perhaps a simple switch statement can render the polygons correctly. Hope I’ve shed some light.

Okay, this is what the article is saying. In a GE2 file, there’s a “list” of data:

name
vertList
normList
uvList
faceParts
triCount
tri

Actually, it’s just data organized in this manner. I’m assuming you’ve already loaded the vertices, normals, and texture coordinates (u-v or s-t coords). Now, that “tri” entry is a list of indices. This identifies the element in the vertices list to be rendered, and all the indices are in groups of three. Therefore, you would render a GE2 file like this:

glBegin(GL_TRIANGLES);
{
int index1,index2,index3;
// Assume: int *tri;
// Assume: float *vertList;
// Assume: float *uvList;
// Assume: tri points to the next triangle
// to be rendered
// Assume: vertList points to the BEGINNING
// of the vertex list
// Assume: uvList points to the BEGINNING
// of the texture coordinate list
index1=*tri++;
index2=*tri++;
index3=*tri++;

glTexCoord2f(uvList[index12],uvList[index12+1]);
glVertex3f(vertList[index13],vertList[index13+1],vertList[index1*3+2]);

glTexCoord2f(uvList[index22],uvList[index22+1]);
glVertex3f(vertList[index23],vertList[index23+1],vertList[index2*3+2]);

glTexCoord2f(uvList[index32],uvList[index32+1]);
glVertex3f(vertList[index33],vertList[index33+1],vertList[index3*3+2]);
}
glEnd();

Slap a for loop around that, and you’ve just rendered an object…I think. :slight_smile: It’s something like that anyway…pardoning any typos I make. XD

[This message has been edited by Nychold (edited 02-13-2004).]

Actually, for some reason my file output is not organized in that manner. I have the following components in my file:

name
vertices
segments
faces
normals
uv-array
face-parts

What options in output did you set in Maya to get that file structure. Thanks.

I think I understand what you are getting at however. It looks like the face section has vertice order. There are three values in each row and the biggest number is in fact the last vertice number. I thought this was wrong earlier because I output in quads once and the lines still had 3 points (which makes no sense for quads). I’ll try that and get back to you guys. Thanks for all the help.

Awesome. It works now. I can’t thank you guys enough.