Sunday, July 03, 2005

When I started working on Simblob 2 back in 2002, I decided to use OpenGL and GLUT. Even though I was developing in Linux, I didn't want to end up in the situation I had with Simblob 1, which only works in OS/2. I finally took advantage of the portable libraries for SimBlob 2 and got it running on my new computer, which runs Windows XP.

I use Cygwin in Windows, so the Unix level libraries are fairly similar. The main difference was that the paths are different. In Linux, I used -lglut -lGLU -lGL, and the compiler was able to find all the headers and libraries. To make it run in Windows/Cygwin, I changed it to -I/usr/include/w32api -L/lib/w32api -lglut32 -lglu32 -lopengl32. Also, glext.h wasn't automatically included, so I had to insert #include <GL/glext.h>. In addition, the multitexturing functions (glActiveTextureARB, glClientActiveTextureARB, and glMultiTexCoord2fARB) don't seem to exist on my system, so I worked around that by using a single texture instead. I'll figure that one out later. I might need to use wglGetProcAddress to get those functions (unfortunately that function is Windows specific).

The one remaining problem I'm having is that when I quit the program by closing the window, GLUT's main loop doesn't exit. It instead starts eating up 100% of the CPU and never terminates. I'm not yet sure if this is a GLUT issue or a Cygwin issue. My workaround is to use Ctrl-C to exit instead of closing the window.

At the moment Simblob depends on Cygwin. You can't just run the Simblob executable; you have to have Cygwin installed. I'd like to try using the MingW option (gcc -mno-cygwin); I just need to remove some other dependencies on Unix libraries first.

I should probably spend some time learning autoconf or some other tools that help manage builds on multiple platforms.

I don't have a Mac handy, but it shouldn't be too hard to make Simblob 2 work on a Mac.

Labels:

0 comments: