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…
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:
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:
// 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
Slap a for loop around that, and you’ve just rendered an object…I think. 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:
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.