I'm trying to build osgEarth with Quarts. Instructions on the official website reads:
Point the QT_QMAKE_EXECUTABLE CMake variable to the qmake.exe you want to use and CMake will populate all the other QT variables.
Good. I do the following:
cmake -D QT_QMAKE_EXECUTABLE=/Users/garbart/Qt/5.10.0/clang_64/bin/qmake CMakeLists.txt
make
And get the following error:
[ 19%] Built target osgEarth
[ 25%] Built target osgEarthSymbology
[ 32%] Built target osgEarthFeatures
[ 35%] Built target osgEarthAnnotation
[ 44%] Built target osgEarthUtil
[ 44%] Building CXX object src/osgEarthQt/CMakeFiles/osgEarthQt5.dir/ViewerWidget.cpp.o
In file included from /Users/garbart/Desktop/osgearth-master/src/osgEarthQt/ViewerWidget.cpp:31:
In file included from /Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/QtGui:45:
In file included from /Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/qopenglcontext.h:61:
/Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/qopenglversionfunctions.h:1089:23: error:
unknown type name 'GLDEBUGPROC'
QT_OPENGL_DECLARE(QT_OPENGL_4_3_FUNCTIONS);
^
In file included from /Users/garbart/Desktop/osgearth-master/src/osgEarthQt/ViewerWidget.cpp:31:
In file included from /Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/QtGui:47:
/Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/qopenglextrafunctions.h:472:33: error:
unknown type name 'GLDEBUGPROC'
void glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam);
^
/Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/qopenglextrafunctions.h:758:23: error:
unknown type name 'GLDEBUGPROC'
QT_OPENGL_DECLARE(QT_OPENGL_EXTRA_FUNCTIONS)
^
/Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/qopenglextrafunctions.h:2213:59: error:
unknown type name 'GLDEBUGPROC'
inline void QOpenGLExtraFunctions::glDebugMessageCallback(GLDEBUGPROC ca...
^
4 errors generated.
make[2]: *** [src/osgEarthQt/CMakeFiles/osgEarthQt5.dir/ViewerWidget.cpp.o] Error 1
make[1]: *** [src/osgEarthQt/CMakeFiles/osgEarthQt5.dir/all] Error 2
make: *** [all] Error 2
QT 5.10.0 osgEarth 2.10
This is how I build OSG, osgQt and osgEarth.
Obtain OSG, configure and build:
git clone --branch OpenSceneGraph-3.6.2 https://github.com/openscenegraph/OpenSceneGraph.git
mkdir osg-build
cd osg-build
cmake ../OpenSceneGraph
make
sudo make install
Obtain osgQt, configure and build:
git clone https://github.com/openscenegraph/osgQt.git
mkdir osgqt-build
cd osgqt-build
cmake ../osgQt -DCMAKE_PREFIX_PATH=/opt/Qt/5.6.3/gcc_64/lib/cmake
make
sudo make install
This last step may fail to build because osgQt is not keeping pace with OSG.
You will need to edit the CMakeLists.txt
and set the directory paths for finding Qt and OSG. The CMakeLists.txt
also hard references a particular version of OSG, this will need to modified. There has been quite a bit of discussion on the lists about these problems so this may have been sorted by the time you read this.
git clone https://github.com/gwaldron/osgearth.git
mkdir osgearth-build
cd osgearth-build
cmake ../osgearth -DCMAKE_PREFIX_PATH=/opt/Qt/5.6.3/gcc_64/lib/cmake
Configure the build using ccmake .
with the following settings:
OSGEARTH_QT_BUILD ON
OSGEARTH_QT_BUILD_LEGACY_WIDGE ON
Build and install:
make
sudo make install
Note: Qt 5.11 should also work.
Update 2 June 2020
osgQt repository has changed a lot since my original post.
This means that the osgEarth 2.10 Qt will not build with osgQt. You will need to probably use the Qt4 tag.
Newer versions of osgEarth no longer have any Qt support.
The approach used to integrate OSG/osgEarth with Qt is a compromise at best.
I would suggest that creating a seperate OpenGL context which OSG/osgEarth uses to render into an offscreen buffer (two needed one for drawing into while the other is being displayed). The offscreen buffer is then displayed by Qt3D using a different OpenGL contex.
This is a more sensible approach as this would allow OSG/osgEarth to use multiple threads.
At the moment Qt and OSG/osgEarth are sharing the OpenGL context.
A starting point is the following post [https://embeddeddevelop.blogspot.com/2017/06/integrating-opengl-and-qtpainter.html] (disclaimer my blog).