Click here to Skip to main content
15,038,345 members
Articles / Multimedia / OpenGL
Posted 16 May 2002


17 bookmarked

Game Exchange 2 File Loader GE2

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
2 Nov 20023 min read
Loads a 3D scene from Maya exported GE2 file/files.


First of all, a little background on the code within.

What is it:

It's a neat little class that loads the GE2 file format as exported with Maya.

What can it be used for:

You can use it to load a scene or object exported by Maya GE2 file format. And then, you can modify further the structures and data / and or render it. Summing it up, use it in your 3D engine if you want to load Maya objects.

How does it work:

The intended way to use it is like:

  1. Simply include the ge2loader.cpp and hpp into your project.
  2. Proceed to make an instance of the object.
  3. Call the loadGroup method with a file name (sample object supplied).

Please note, if you really don't have any idea as to what GE2 is, then please do a bit of research. Or at least have a look at the file structure in the sample object, creatively called Dork.

  1. #include "..\MODULES\objGameExchange2\ge2loader.hpp"
  2. class ge gameExchange;
    void main ( void ) 
  3.   int ret = gameExchange.loadGroup("dork\\dork.grp");
      if ( ret==-1) cout << "error\n\n";

I don't feel that this class can be very useful to anyone at all unless they intend to plug it into a 3D rendering environment. In my opinion, GE2 export is probably the most useful of all the available exporters that you get with Maya. Future plans are to code an editor that utilizes this GE2; the editor being an intermediate tool that fine tunes the scene for game dev. purposes such as texturing, BSP generation etc... I know it's a big dream but I have had big dreams before, just have a look at my homepage.

At this time, I won't go into a detailed description on the file format or the loader code itself. But rest assured that it does work. Please visit my homepage for more information on my little coding projects.

I have had a few people asking me how to use the data structure for rendering, I have included this email where I explain how to use the data structure.

My reply to Mondi's query:

Sorry for the late reply, I have not been enthusiastic to look up the info to help you, primarily because I know I lost my source code to this long ago :( Anyway I'm bored today and decided to download the from my homepage and have a quick look and attempt to explain things to you :). So referring to The object is called a, within my demo code.

a.obj.cout tells me there are 6 objects to render. The objects exists at a.obj.o[0] to a.obj.o.[5].

An object is made up of:

  • name
  • vertList
  • normList
  • uvList
  • faceParts
  • triCount
  • tri

OK, let's do a theoretical example. What you want to do is render the first triangle. If you debug the demo code and have a look at the structure, you will see that the first Tri of the first object named "InsideFaceShape" expands to:

  • v[0] = 454
  • v[1] = 455
  • v[2] = 1

This is telling me to look up those vertices:

So, to render the first tri of the first object:

Beginrender() {

// this demonstrates access to the first vertex
// a. : the entire ge2 structure with all the various files
// a.obj : a pointer to an array with count and another pointer o
// a.obj.o: another pointer to an array of objects

// ok, the first object a.obj.o[0]
// is made up of many triangles a.obj.o[0].tricount
// a.obj.o[0].tri is a pointer to indexes to the real float values
// the idea is to grab an idex a.obj.o[o].tri[0].v[0]
// this is actually the number 454 according to my demo
// this means you want vertex number 454 from the vertex array

// for example, a.obj.o[0].vertList.v[0].x
// this is the first vertex float value for the x-coordinate
// BUT! this is not the X coord for the first point of the first triangle
// it is simply a list of vertecies , and the idea is to access them
// with indexes
// in the same way, you can access the UV's and normals 

// whew.. I hope this helps somewhat.. 

glvertex3f (

glvertex3f (

glvertex3f (

OK, now I know it seems terribly complex, and when I did this code, I was rushing and didn't think out the structures well. One of the things that is probably confusing you is Obj and o... Instead, I should have named:

  • Obj as ObjList
  • and o as Obj

Another thing is faceParts, I cant remember exactly.. but what it is that each triangle has a material description.. best way to analyze it is to start debug mode and expand the structure in a Watch list.

As far as this goes for use in a big project, it probably isn't good enough, but it's fairly useful to load all the text files into a structure, and hopefully is quite usable for testing.

> "mondi"  "RJ++" <> [CodeProject] 
> Game Exchange 2 File LoaderDate: Sun, 27 Oct 2002 05:32:17 -0500
>Hi there,
>I've been experimenting with the ge2 format for awhile now, 
>your code helped me clear up a few issues i was having.
>question though, being not a terribly good programmer 
>could you point me in the right direction for
>accessing the vertex/face/normal lists so that 
>I could get my app to render the objects?
>it would be incredibly helpful :)


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

United States United States
* Diploma in Computer Science TAFE

* Bachelor of Science , Computer Science

* Experienced OpenGL API 3D rendering

* Speak fluent C/C++

* Network Administration

Someone please hire me, Im very much looking for work as a developer.

Comments and Discussions

GeneralHaving Problems with GE2 Pin
shehzadafarhan8-Jul-06 23:44
Membershehzadafarhan8-Jul-06 23:44 
GeneralProblem with GE2 Exporter Pin
Chilligan18-Sep-04 19:03
MemberChilligan18-Sep-04 19:03 
Generalsmall question about OpenGL Pin
28-May-02 0:07
suss28-May-02 0:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.