This page descibes how to build the SoQt GUI for Coin 3D.
SoQt depends upon the the Qt libraries. For Linux, you must first build the Qt source and then install the libraries from the local build.
Qt has the following dependencies:
sudo apt-get install libfontconfig1-dev libfreetype6-dev libx11-dev libxcursor-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxrandr-dev libxrender-dev
The Qt package can be downloaded from the Qt Downloads archive: https://download.qt.io/archive/qt/4.8/4.8.6/. The package is qt-everywhere-opensource-src-4.8.6.tar.gz.
Do the following to extract the source:
tar -xvzf qt-everywhere-opensource-src-4.8.6.tar.gz
Build the libraries and distribution elements (i.e. documentation and tools). Be sure to enable the HTML and man page generation.
cd qt-everywhere-opensource-src-4.8.6
./configure --enable-html --enable-man
Build the libraries and tools using:
make
To install the libraries and tools
make install
The build artifacts will be installed in /usr/local/Trolltech/Qt-4.8.6/.
Set the QTDIR environment variable to /usr/local/Trolltech/Qt-4.8.6/.
export QTDIR=/usr/local/Trolltech/Qt-4.8.6.
Update the PATH environment variable to locate the Qt tools.
export PATH=$QTDIR/bin:$PATH
These instructions focus on building the SoQt GUI library from a tar distribution package. The instructions are geared towards an Ubuntu 14.04 LTS host development platform.
SoQt has the following dependencies:
The SoQt package can be downloaded from the Bitbucket account: https://bitbucket.org/Coin3D/coin/downloads. The package is SoQt-1.5.0.tar.gz.
Do the following to extract the source:
tar -xvzf SoQt-1.5.0.tar.gz
Build the libraries and distribution elements (i.e. documentation) in a separate directory. Be sure to enable the HTML and man page generation.
mkdir soqt-build
cd soqt-build
../SoQt-1.5.0/configure --enable-html --enable-man
Build the SoQt library, libSoQt.so:
make
To install the library, header files and documentation, do the following:
make install
The library will be installed in /usr/local/lib/libSoQt.so. The header files will be installed in the /usr/local/include directory. HTML pages are populated in the /usr/local/share/doc/soqt/html directory. The manual pages are installed into /usr/local/man.
The following is an example on how to use the SoXt library:
#include <Inventor/Qt/SoQt.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
#include <Inventor/nodes/SoBaseColor.h>
#include <Inventor/nodes/SoCone.h>
#include <Inventor/nodes/SoSeparator.h>
int
main(int argc, char ** argv)
{
// Initializes SoQt library (and implicitly also the Coin and Qt
// libraries). Returns a top-level / shell Qt window to use.
QWidget * mainwin = SoQt::init(argc, argv, argv[0]);
// Make a dead simple scene graph by using the Coin library, only
// containing a single yellow cone under the scenegraph root.
SoSeparator * root = new SoSeparator;
root->ref();
SoBaseColor * col = new SoBaseColor;
col->rgb = SbColor(1, 1, 0);
root->addChild(col);
root->addChild(new SoCone);
// Use one of the convenient SoQt viewer classes.
SoQtExaminerViewer * eviewer = new SoQtExaminerViewer(mainwin);
eviewer->setSceneGraph(root);
eviewer->show();
// Pop up the main window.
SoQt::show(mainwin);
// Loop until exit.
SoQt::mainLoop();
// Clean up resources.
delete eviewer;
root->unref();
return 0;
}
Attaching an Eclipse CDT (Mars) project that builds the above example code.