Celestia + GTK + WindowsXP = Pure Crackery
To end the month with a bit of a bang, I set my project for today (well,
yesterday, I guess) to port Celestia's GTK+ UI to native Windows. After all,
both GAIM and The Gimp have done it, and I knew that GTK's OpenGL widget,
gtkglext, has been ported, though I didn't know how well it worked.
After a half day of messing around with trying to make it work under MinGW32 (after a full day of getting all the GTK+ libraries to work correctly), I decided that the Unix Makefiles were just far too centered around X and Mesa to be useful for this test. Instead, I decided to give Microsoft Visual Studio .NET a try, with the GladeWin32 libraries and development headers. These were very easy to install. Compiling even vanilla Windows Celestia proved a little more tricky.
Changing the Makefiles to work with the GTK files was pretty much the other half of the day. The code itself only needed a one function change (that will work under Linux as well), one define (which will be fixed in the Makefile eventually), a couple of locales lines temporarily commented out, and a dummy WinMain() that just calls main(). I even left the Win32 resources compiling in, giving me the pretty icon built into the binary. The biggest addition looks like this:
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { return main(__argc, __argv); }
Considering that there was some talk in the past of unifying some of Celestia's GUIs, GTK might be a viable option. By this time next year, this same trick should work on MacOS, which would cover all of the platforms. There is also no reason why this GTK Celestia can't reuse the existing Windows Registry functions for settings. I thought that there might be some limitations to the OpenGL capabilities, but all of my card's shaders are recognized and the rendering is surprisingly fast, with no apparent FPS penalty.
GTK+ has come a long way.