Sunday, June 21, 2009

Porting fracplanet to Qt4 (actually Qt3Support)

I decided to try a quick hack-and-slash port of fracplanet to a more recent version of Qt.  Since I’m using a windows box I installed the Qt SDK for Windows.  Also, downloaded and installed the version of MinGW from trolltech as part of the install.  I installed Qt to C:\Devel\Qt\4.5.1 and MinGW to C:\Devel\Qt\MinGW
First step ran qt3to4 on fracplanet.pro, then qmake VERSION_NUMBER=0.4 fracplanet.pro, and make.  I’m missing dependencies like boost so I didn’t expect this to get very far.  It didn’t.
First problem was the VERSION_NUMBER=0.4.  At line 32 in control_about.cpp their isn’t a automatic conversion from QChar to double.  So next I did qmake VERSION_NUMBER=1 fracplanet.pro, and make.
Got to line 55 of control_about.cpp and had to change it to:
license->setTextFormat(Qt::PlainText);
Did make again and now the boost problem.  Since this was supposed to be a quick hack-and-slash I didn’t bother building boost. Found and  installed Boost-1.34.1-mingw.exe into C:\Devel\Boost-1.34.1 and added the following directives to fracplanet.pro:
LIBS += -lboost_program_options-mt
INCLUDEPATH += C:\Devel\Boost-1.34.1\include
LIBPATH += C:\Devel\Boost-1.34.1\lib
LIBPATH += C:\Devel\MinGW\lib
Then redid qmake VERSION_NUMBER=1 fracplanet.pro, and make.
Next problem was a mission qhbuttongroup.h in control_render.h at line 27.  Appears that the qhbuttongroup was rolled into qbuttongroup at some point. qt3to4 didn’t pick this one up so I mannually changed qhbuttongroup.h to q3buttongroup.h.  Same in control_terrain.h.
Copied usage_text.h out of a previous build with cygwin to get around figuring out how to actually build the documentation.
Changed  line 113 in fracplanet_main.cpp to
progress_dialog->setLabelText(QString(progress_info.c_str()));
Added the following before the use of glDrawRangeElements in triangle_mesh_viewer_display.cpp
PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = NULL;
glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)wglGetProcAddress("glDrawRangeElements");

Then redid qmake VERSION_NUMBER=1 fracplanet.pro, and make.  And the end result… A working copy of fracplanet built against Qt 4 compiled with MingW. 
image image
OK, technically it’s still Qt 3 since it uses Qt3Support.  Also, has to be run from the command line at the moment.  Might fix it up and package it later.

Building fracplanet with cygwin

Took a whack at building fracplanet with cygwin on a Windows box yesterday afternoon.  It was too hot outside to mow the lawn.

Some things that I had to do to get it built:

  • Edit the fracplanet.pro file so it could find the installed version of boost.  I added the following:

LIBS += -lboost_program_options-gcc-mt
INCLUDEPATH += /usr/include/boost-1_33_1

  • Edit the line 103 in /usr/include/boost-1_33_1/boost/random/mersenne_twister.hpp to

x[j]=gen;

instead of

x[j]=gen();

  • Had to go back and install libglut for cygwin.

After that the program compiled and linked.

I ended up using Xming instead of the X server bundled with cygwin.  Of course I had to make sure to start Xming before bash and set the display by hand (export DISPLAY=localhost:0.0).

 

Here is my first planet.

image image

And here it is rendered by POV-Ray for Windows.

image

MSN Web Messenger

Started playing with the Ubuntu Netbook Remix on an Acer Aspire One and “needed” a quick way to get on Live without using a native linux client.  After a bit of searching came across the MSN Web Messenger.