XGL Viewer

Contents: 
Subjects: 

This is a viewer for XGL files. I specifically wrote this to display and animate a model of the Circuitrunners 2005 FIRST robot's base. The model was created in Autodesk Inventor and exported as a ZGL files (which is XGL compressed with gzip). This program reads the uncompressed XGL file.

This program has some hard-coded information about the XGL file:

  • ID's of objects to animate
  • Extents and position of the model
  • Filename to load

It would be easy to modify this program to work with other files, but at the time I didn't consider it important enough to make this program properly generic.

Keys:

Key Description
ESC Exit the program
1 Toggle rotation animation
2 Toggle expansion animation
3 Toggle wireframe/solid fade animation
4 Toggle using light map as specified in the XGL file
9 Reset the wireframe/solid fade
0 Reset all parameters

Moving the mouse rotates the model.

The robot really did do the expansion thing, but not as well as the animation suggests.

Unless you have a really good computer, this program will take a few seconds to load and will have a poor frame rate. The model is excessively detailed and includes every tooth on every gear - this is what we built from.

Download the code

split.c is a program to split a file into lines of reasonable length, since the XGL produced by Inventor is all on one line and this makes it hard to edit/view.

This program depends on libxml2. The Makefile provided is ready to use for Linux and has build flags for Mac OS X. The program can be built on Windows but I don't have project files for this.