Porting and Running the VTP Software on Unix/Mac

(Linux, MacOSX, BSD...)
Some notes regarding porting and running the VTP software.

Mac porting issues

Enviro issues with 3D Cards

Some cards and drivers on Linux have demonstrated issues, while other work well.  The issue is only with the VTP apps which attempt to open an OpenGL context.  Here are reported behavior as of 2004:

OS compiler XFree Card Driver Reported Result
modified Knoppix (Debian)
w/kernel 2.4.25
gcc 3.3.3 4.3.0.1 ATI mobility Radeon 9600 ATI driver v3.7.6 Generally works.
On ~20% launches of wxEnviro, the app stops at "First OnPaint message".
When closing the app, usually get a segfault after "Deleting Canvas."; occasionally get a clean shutdown.
Red Hat 9 (2.4.20-20.9) gcc 3.2.2 4.3.0-2 NVidia Geforce2 1.0-4496 Gdk-ERROR **: GLXBadDrawable serial 5253
Red Hat 9 (2.4.20-20.9) gcc 3.2.2 4.3.0-2 NVidia Geforce2 1.0-5336 Generally works; occasionally get GLXBadDrawable
Red Hat Fedora (2.6.4) gcc 3.3.3 4.3.0-55 NVidia TNT2 1.0-5336 GLXBadDrawable error.
Red Hat Fedora (2.6.4) gcc 3.3.3 4.3.0-55 NVidia TI4200 GeForce 4 1.0-5336 Generally works, but app did not exit properly.
Libranet (Debian based)     NVidia   GLXBadDrawable, often ("About every 5 or 10 tries wxEnviro would get past this problem")

Other issues:

Porting wxWindows Icons from Windows to Linux/GTK+

Bitmaps and Icons

The wxWindows documentation, in the section "Bitmaps and icons overview", describes the process of creating bitmaps and icons with the wxBITMAP and wxICON macros.  On Windows, these pull the images from the Windows Resources embedded in the program.  On Unix, the images are instead placed into XPM files (.xpm), and #include is used to compile them into the program.  The general process is to create the BMP (.bmp) and ICO (.ico) files on Windows, and maintain a separate XPM file for each.

Converting ICO to XPM with Transparency

This conversion is somewhat tricky, partly due to the fact that ICO support is found primarily in Windows programs, and XPM is used only on X-Windows.  Here are the steps which i found to work:

  1. Install a recent version of ImageMagick.  It is free and there are binaries available for each platform.  Beware of the version number: older versions (e.g. 5.3.0) are known to not handle ICO and XPM correctly.  I installed 5.5.3 and found that it worked correctly.
     
  2. Use the ImageMagick utility convert to convert each of your ICO to XPM, like this:
      convert building.ico building.xpm

    Note that on some versions of Windows, there is potential conflict with a program called "convert" which is part of the OS.  To avoid this, you can rename the ImageMagick program from convert to convert2.
     
  3. Edit the XPM file.  It is a text file.  At the top, you will see a line like this:
      static char *building[] = {

    wxWindows wants you to add an "_xpm", like this:
      static char *building_xpm[] = {

  4. In each XPM file, you will see some entries like this:
    " c black",
    ". c #80000000",
    "X c #80800000",
    "o c None",

    The hexadecimal values are colors, and wxWindows only wants 6 characters, not 8.  Shorten them like this:
    " c black",
    ". c #800000",
    "X c #808000",
    "o c None",

That's it!  There are other programs such as Python Image Library (PIL) which will do the conversion, but they don't preserve transparency.