libQGLViewer installation
linux Unix systems mac

» Installation on Linux and Unix : libQGLViewer and Qt
» Installation on Macintosh : libQGLViewer and Qt
» QGLViewer designer plugin installation
» Troubleshooting

linuxLinux and Unix

Compilation and installation

Directly install Debian package (made by Artur Czechowski) or the pre-compiled RPM (built on Fedora Core 2 with gcc 3.3.3):
rpm -Uvh libQGLViewer-2.0.0-3.i586.rpm libQGLViewer-devel-2.0.0-3.i586.rpm

However, for optimal results, compile from the sources:
rpmbuild --rebuild libQGLViewer-2.0.0-3.src.rpm
cd /usr/src/RPM/RPMS/i586/ (or /usr/src/redhat/RPMS/i586, see the rpmbuild last log lines)
rpm -Uvh libQGLViewer-*2.0.0-3.i?86.rpm
or using the source tarball:
tar -xzf libQGLViewer-2.0.0-3.tar.gz
cd libQGLViewer-2.0.0-3/QGLViewer
qmake (see options below)
make
make install
You need root privileges to install the library, since default install paths are system directories.

Compilation of the examples

Once the library is installed, compile the examples and test them:
cd ../examples
qmake
make

Custom installation

The following files are installed:

  » RPM customization
If you want to change the RPM installation prefix, say to /usr/local instead of the default /usr, use rpm -Uvh --prefix /usr/local ... in the rpm command line instead.

  » qmake customization
Optional qmake parameters let you customize your make install installation directories:

qmake [PREFIX=...] [INCLUDE_DIR=...] [LIB_DIR=...] [DOC_DIR=...]
A typical usage would be qmake PREFIX=$HOME. Default values are:
- Param -      - Default value -
PREFIX         /usr
LIB_DIR        PREFIX/lib
INCLUDE_DIR    PREFIX/include
DOC_DIR        PREFIX/share/doc
Use the same qmake parameters when you compile the examples.

If your Qt version is lower than 3.1, you need to link with the glut library: uncomment a line in QGLViewer.pro as explained. glut can be installed using the freeglut-devel rpm or with apt-get libglut3-dev.

linux   Qt   Qt installation

You need to have the Qt library installed in order to run libQGLViewer. Qt is probably already installed on your machine, or available on your distribution CDs. You may however have to install the qt3-devel (rpm) or aptget libqt3-mt-dev (debian) development package. The complete Qt/X11 non commercial version can also freely be downloaded from Trolltech.

Try to compile a simple Qt example and check the Qt FAQ page in case of problem. Consider compiling one of the Qt OpenGL examples to test your configuration.

If your shell is bash or zsh (use echo $SHELL to know), add these lines to your .profile:
export QTDIR=/usr/lib/qt3 (or /usr/lib/qt-3.3 or /usr/share/qt...)
export PATH=${PATH}:${QTDIR}/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${QTDIR}/lib
If you use tcsh or csh instead, add these lines to your .login:
setenv QTDIR /usr/lib/qt3 (or /usr/lib/qt-3.3 or /usr/share/qt...)
setenv PATH ${PATH}:${QTDIR}/bin
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${QTDIR}/lib
Source this file or open a new shell to take these values into account. If you installed libQGLViewer in a custom directory, add the path to this directory in LD_LIBRARY_PATH as is done above for ${QTDIR}/lib.


mac Mac OS X

The installation procedure is essentially identical to the one described in the Linux section:
tar -xzf libQGLViewer-2.0.0-3.tar.gz
cd libQGLViewer-2.0.0-3/QGLViewer
qmake
make
make install
See the Linux section for details and install paths customization. Once the library is installed, compile the examples and test them:
cd ../examples
qmake
make
Threads are activated with the darwin-g++ version and disabled with macx. Add or remove thread in the CONFIG section of .pro files if this does not correspond to your Qt configuration.

If your Qt version is lower than 3.1, you need to link with the glut library. Install glut and uncomment a line in QGLViewer.pro as explained.

mac   Qt   Qt installation

Qt is available under two versions for the mac architecture : You have to define some variables as is detailed in the Qt linux section. Check their current values first.
If your shell is bash or zsh (use echo $SHELL to know), add these lines to your .profile:
export QTDIR=/sw (if you use fink, or to set to where ever Qt was installed)
export PATH=${PATH}:${QTDIR}/bin
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${QTDIR}/lib
export QMAKESPEC=darwin-g++ (or macx-g++ or macx-mwerks or macx-pbuilder)
If you use tcsh or csh instead, add these lines to your .login:
setenv QTDIR /sw (if you use fink, or to set to where ever Qt was installed)
setenv PATH ${PATH}:${QTDIR}/bin
setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:${QTDIR}/lib
setenv QMAKESPEC darwin-g++ (or macx-g++ or macx-mwerks or macx-pbuilder)
Your QMAKESPEC should correspond to your Qt installation : macx-g++ for Qt/Mac (or macx-mwerks with CodeWarrior, macx-pbuilder with Project Builder) and darwin-g++ for X11. Compile a simple Qt example to check your configuration.

If you installed libQGLViewer in a custom directory, add the path to this directory in DYLD_LIBRARY_PATH as is done above for ${QTDIR}/lib.




Qt Installation of the designer plugin

This installation is optional. To compile and install the QGLViewer designer plugin:
cd designerPlugin
qmake
make
make install
The make install step requires root privileges since the plugin is installed in $QTDIR/plugins/designer, which is usually a system directory.

Such a plugin eases the creation of user interfaces that feature a QGLViewer using designer. It makes a GLViewer icon appear in the designer's Display widget tab, as a standard Qt widget. When added to your user interface, the widget displays the standard spiral, which can be rotated when you test your interface (using Ctrl+T).

    Designer plugin
All the viewers' signals and slots are available and can be connected to your interface.

Note that an alternative to this plugin is to add a "Custom Widget" using the Tools/Custom designer menu. Load Descriptions... and provide the qglviewer.cw custom widget description file, located in the QGLViewer header files directory. You can customize this description with your own signals and slots and change the header file path.

See the interface example for an illustration of a user interface that includes a QGLViewer.

Troubleshooting

Please let me know if you encountered specific installation problems that could be reported on this page.

Valid XHTML 1.0! Valid CSS! Last modified on Thursday, July 7, 2005.