Linux: osgEarth and Qt with CoreProfile

This post follows on from the previous post of using osgEarth with OpenGL CoreProfile with an Intel GPU.

Either way the simplest way to integrate Qt and osgEarth is to use the osgEarthQt widgets.

I am using the QtGui::ViewerWidget.

First we need to specify to OSG that we want to use OpenGL version 4.5. With the Intel GPU this will result in a CoreProfile context as Mesa only supports CoreProfile for Intel GPU for versions 3.2 and newer.

This is achieved by the following:

osg::DisplaySettings::instance()->setGLContextVersion("4.5");

Of course you should really check what the highest version of OpenGL is supported rather than assuming 4.5, as shown above.

As of today (22/07/2018) this will not work as Qt is not told which OpenGL version to use.

However the following pull request updates QtGui::ViewerWidget to tell Qt which OpenGL version to use:
  •  https://github.com/gwaldron/osgearth/pull/1164

Comments