[osg-users] How to prevent OSG linking against Desktop OpenGL

Daniel Neos daniel.rd at hotmail.de
Fri Sep 9 09:04:13 PDT 2016


Hi,

my Applcation mainly uses Qt(with QOpenGlWidget) and OpensceneGraph, thus it relies heavily on OpenGL.

Since the Remote Desktop Protocol(RDP) poorly supports OpenGL, there is no trivial way to run
my application over Windows Remote Desktop. Hence, I choose to use Softwarerendering as a fallback.

I can tell Qt which opengl version to use programmatically with QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL, true);
or QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL, true);

But osg seems to strictly link against opengl.dll from the desktop version, no matter if i am delay loading the osg*.dll i am using or not.

When delay loading the osg*.dll , the desktop version will be loaded when the application makes it first contact with osg-related stuff, 
in my case it is an objects which inherits from QOpenGLWidget integrating the openscenegraph view


Code:

OSGWidget::OSGWidget(QWidget* parent, Qt::WindowFlags f)
    : QOpenGLWidget(parent, f)
    , m_graphicsWindow(new osgViewer::GraphicsWindowEmbedded(x(),
        y(),
        width(),
        height()))
    , m_geometry(new osg::Geometry())
    , m_isInitialized(false)
    , m_compositeViewer(new osgViewer::CompositeViewer)
    , m_camera(new osg::Camera)
    , m_view(new OsgView)
    , m_geometryNode(new osg::Geode)
    , m_pickEventHandler(new PickEventHandler(static_cast<OSGWidget&>(*this)))
    , m_camManipulator(new OsgCameraManipulator)
    , m_depthData(nullptr)
    , m_markedPoint(QPoint(DepthDataSet::InvalidPixelCoordinateValue, DepthDataSet::InvalidPixelCoordinateValue))
    , m_isMarkedPointVisible(false)
    , m_isRendering(false)
{
}





Everything works fine using the desktop version of openg. But If I am trying to link against the opengl32sw.dll(from Qt), 
osg seems to ignore it and links the desktopOpenGL.

The leads to the problem that the application crashes in the deep of osg.
To be more specific, here is an excerpt of the callstack from top to bottom.

->OSGWidget::paintGL()
 ->m_compositeViewer->renderingTraversals()
  -> ViewerBase::makeCurrent()
   -> osg::GraphicsContext::makeCurrent() 
    -> osg::State::initializeExtensionProcs()


Here I need to say that my first step is trying to run the application with
software rendering only, before switching to Remote Desktop.


I suspect that the mixture of the opengl32.dll versions leads to crash the application or maybe
even somethings is wrong with the opengl32sw.dll from Qt. But everything non-related to osg seems
to be displayed fine. I am using osg 3.4.0 and Qt 5.7


So how can I run osg Code based on Software rendering?





Thank you!

Cheers,
Daniel[/b][/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68563#68563








More information about the osg-users mailing list