LibMini Tutorial
Terrain Rendering with LibMini
Libmini is free software that displays geographic terrain data at real-time. This is an example application of integrating libmini in the Qt user interface. The application, the libMini QTViewer, primarily uses libmini viewer functions but provides additional camera control. It is free software licensed under the GPL.
Tested platforms are:
- MacOS X 10.5 and 10.6
- Debian
- Ubuntu 11.04, 12.04, 13.10 and 14.04
- Linux Mint 13
- OpenSuSe 11.4
- Windows XP and Windows 7
Other platforms may work, but are untested.
Prerequisites
The compilation of the libMini QTViewer requires the installation of:
tcsh, autotools and cmake (unix) gnu/c++ (unix) or MSVC compiler (windows) svn and git (unix) or Tortoise SVN (windows) OpenGL (and GLUT) qt/qmake
The installation of OpenGL and GLUT is vendor specific: On MacOS X it is already installed with the XCode development package, on Linux it comes with the “mesa-dev”, “X11-dev” and “free-glut3-dev” development packages whereas on Windows it is usually installed with the MSVC IDE.
On MacOS X and Windows, it is recommended to build and install Qt from source! On Linux, it is mostly sufficient to install a recent Qt binary package.
If you install Qt from source, grab the source tar ball from:
Qt4.7: ftp://ftp.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz/.zip Qt5.3: http://download.qt-project.org/official_releases/qt/5.3/5.3.0/single/qt-everywhere-opensource-src-5.3.0.tar.gz/.zip
Qt Installation (Unix/Mac)
Type on the unix console in your Qt source directory:
./configure -opengl -release -nomake examples -nomake tests -opensource -confirm-license && make && sudo make install
After the build process has finished (go get yourself a cup of coffee), you will be asked to enter your root password for installation of Qt.
Qt Installation (Windows):
Open a MSVC command prompt via
Programs → MSVC → Tools → MSVC Command Prompt
Choose an appropriate platform to describe the version of MSVC:
MSVC 8.0 → SET PLATFORM=win32-msvc2005 MSVC 9.0 → SET PLATFORM=win32-msvc2008 MSVC 10.0 → SET PLATFORM=win32-msvc2010
Navigate into the Qt source directory and type
configure -platform%
PLATFORM%
-opengl desktop -release -nomake examples -nomake tests -opensource -confirm-license
Add the “bin” directory in your Qt directory to your path:
set PATH=%
cd%
\bin;%
PATH%
Or add the “bin” directory to your PATH environment variable:
System → Advanced → Environment Variables → PATH
Check for working qmake
qmake —version
At your option, you can configure Qt to produce static libraries with
configure -platform%
PLATFORM%
-opengl desktop -release -static -no-libpng -no-sql-sqlite -nomake examples -nomake tests -opensource -confirm-license
Installation of Libmini Dependencies (Unix/Mac)
Get the libMini dependencies from the libMini subversion repository. Type on the unix console in your project directory (e.g. ~/Projects):
svn co http://svn.code.sf.net/p/libmini/code/libmini/deps deps (cd deps; ./build.sh)
Installation of Libmini Dependencies (Windows)
Precompiled static libraries for Windows MSVC 2005 are provided in the libMini WIN32 directory. In your project directory, get the following sub-directory via Tortoise SVN:
http://svn.code.sf.net/p/libmini/code/libmini/WIN32
Additionally we need GDAL to be installed. In your project directory, get GDAL via Tortoise SVN:
http://svn.osgeo.org/gdal/tags/1.8.1/gdal
The settings of the Windows GDAL build are defined in nmake.opt.
To build GDAL we need to override the following settings: MSVC_VER → use 1600 to identify MSVC 10.0, 1500 for MSVC 9.0, etc. GDAL_HOME → needs to point to the GDAL installation directory Usually this means that we point it to our project directory
Open a MSVC command prompt via
Programs → MSVC → Tools → MSVC Command Prompt Navigate into the GDAL source directory and type set PROJ=“your project directory” e.g set PROJ=“C:\Users\roettger\Projects” nmake /f makefile.vc MSVC_VER=1600 GDAL_HOME=%PROJ% nmake /f makefile.vc MSVC_VER=1600 GDAL_HOME=%PROJ% devinstall nmake /f makefile.vc MSVC_VER=1600 GDAL_HOME=%PROJ% staticlib copy /y gdal.lib %PROJ%\lib copy /y port\*.h %PROJ%\include copy /y gcore\*.h %PROJ%\include copy /y ogr\*.h %PROJ%\include
QTViewer Checkout and Compilation (Unix/Mac)
Type on the unix console in your project directory:
svn co http://svn.code.sf.net/p/libmini/code/libmini/qtviewer qtviewer with cmake: (cd qtviewer; cmake . && make) with qmake: (cd qtviewer; ./build.sh)
If you installed Qt5, be sure to enable the BUILD_WITH_QT5 option:
(cd qtviewer; cmake -DBUILD_WITH_QT5 . && make)
QTViewer Checkout and Compilation (Windows)
In your project directory, get the following subversion repository via Tortoise SVN:
http://svn.code.sf.net/p/libmini/code/libmini/qtviewer
Open a MSVC command prompt via
Programs → MSVC → Tools → MSVC Command Prompt
Navigate into the qtviewer source directory and type
build.bat
Installation (Unix)
If you want to install the application as a desktop application, just run the install script:
./install.sh
After installation, the viewer is available as desktop application. On
Ubuntu, for example, you can simply search for it in the start menu.