Change OpenGL library types easily


This incredibly simple-minded Perl script, libflip, allowed us to easily change OpenGL related libraries to different types for benchmarking and testing purposes.

We currently use the ATI FireGL accelerated GL libraries, the Mesa 3.4.2 glut libraries and the SGI GLU libraries. While testing, I needed to quickly be able to flip back and forth between Mesa GL/ATI GL and Mesa GLU/SGI GLU. Hence, this quick little hack.

This was a quick (20 minute) hack and doesn't have any niceties like keeping RPM databases up to date. It was simply meant for quick library flipping on test machines.

The variables that require modification in the script are:

# Root directories for the source and destination library trees. my $srcroot = "."; my $destroot = "/"; # Define the specific library you want to install for each library type. my %libs = ( "GL" => "ATI-1.9.20", "GLU" => "oss-opengl-glu-20000925-1", # "GL" => "Mesa-3.4.2-7", # "GLU" => "Mesa-3.4.2-7", ); $srcroot is the top-level location of the source library trees.
$destroot is the top-level location of where to place the libraries.
%lib contains the library type to library tree mapping.

In the above example, the GL libraries will be from the ATI-1.9.20 tree in the current directory, the GLU libraries will be from the oss-opengl-glu-20000925-1 tree in the current directory and they will be placed in the standard place... the root filesystem.

The library trees are just that... simply trees that get copied to the appropriate places for each library type. The structure of the tree is specific. Each tree must exist as a subdirectory of the library type.

In the above example:

  • ./GL/ATI-1.9.20 contains the tree for the ATI GL libraries
  • ./GL/Mesa-3.4.2-7 contains the tree for the Mesa 3.4.2-7 GL libraries
  • ./GLU/oss-opengl-glu-20000925-1 contains the tree for the SGI GLU libraries
  • ./GLU/Mesa-3.4.2-7 contains the tree for the Mesa GLU libraries
  • Simply populate the trees appropriately using rpm2cpio from RPM archives, cp from a source tree or whatever method you prefer. Headers should be included in the appropriate trees if you plan on compiling any programs.

    To give you an idea of what these trees look like, click here for a graphical representation of the trees for our RedHat 7.2 machines.

    These trees contain:

  • ATI GL libraries for the 1.9.20 FireGL driver (kernel specific)
  • Mesa 3.4.2 GL libraries
  • SGI GLU libraries (oss-opengl-glu-20000925)
  • Mesa 3.4.2 GLU libraries
  • If you care, libflip-tree.tgz, is a gzipped, tar archive of the above trees... you won't be able to use the ATI GL libraries, but you'll get the idea of the structure.

    One thing to note is that the script needs to properly clean out all traces of the old libraries. This includes anything that might be in /usr/X11R6/lib/modules/dri or /usr/X11R6/lib/modules/drivers. If you have accelerated drivers for, say, and NVidia card, you will need to modify the clean_GL and clean_GLU subroutines to take care of this.

    Once you've populated the source library trees, you should simply need to edit the %lib variable to point to the appropriate libraries and run libflip.

    Just a note: We don't actually use this script anymore.
    We now create RPM packages for the appropriate libraries and use them to install and update. They, basically, mimic what this script does in a bit cleaner fashion.


    Last modified: Fri Jun 14 15:00:13 2002