[Interest] Qt 5 and OpenSceneGraph 3 no longer friends?

Agocs Laszlo Laszlo.Agocs at digia.com
Thu Jun 19 15:35:59 CEST 2014


Yes, based on a quick glance at the code, the OSG Qt adaption creates a QGLWidget and then uses the underlying QGLContext/QOpenGLContext on another thread. The patches floating around the net just add moveToThread() calls moving the object back and forth between the gui thread and osg's rendering thread.

The presence of the thread check in QOpenGLContext is a bit unfortunate in this case, since the context is never used outside the rendering thread, it's just that it is created on and thus belongs to the gui thread.

The quick fix is to stop using QGLWidget's internal context and instead create and use a separate QOpenGLContext on OSG's render thread.

In an ideal world the adaption code would be redesigned to use QWindow/QOpenGLContext instead of QGLWidget. These are much better suited for these kind integration purposes than the legacy QGLWidget. This is probably a slightly bigger task though.

Bests regards,
Laszlo


________________________________________
From: interest-bounces+laszlo.agocs=digia.com at qt-project.org [interest-bounces+laszlo.agocs=digia.com at qt-project.org] on behalf of Gunnar Sletta [gunnar.sletta at jolla.com]
Sent: Thursday, June 19, 2014 2:46 PM
To: Rollastre Prostrit
Cc: interest at qt-project.org
Subject: Re: [Interest] Qt 5 and OpenSceneGraph 3 no longer friends?

For the sake of sanity, we made a requirement that QOpenGLContext::thread() is the same thread that you make it current in. Is it possible for you to move the QOpenGLContext to the rendering thread in question? (using QOpenGLContext::moveToThread(renderThread)).

Or is OSG moving constantly moving the QOpenGLContext between threads?

cheers,
Gunnar

On 19 Jun 2014, at 14:25, Rollastre Prostrit <rollastre at gmail.com> wrote:

> Hello.
>
> We recently upgraded our Qt&OSG application to Qt 5.3 from Qt 4.8.4. The
> result is that the application does not work anymore and crashes when
> realizing the graphics context no matter which version of OSG or how we
> build it. It always ends up giving the following message
>
> "Cannot make QOpenGLContext current in a different thread"
>
> There seems to be a consensus in the OSG community that this is not an OSG
> fault but Qt's. There are also several patches provided by external users
> which claim to solve the problem. However, we didn't succeed applying them.
> So the situation seems to be that we have to choose between going back to Qt
> 4.8 ( losing quite a lot of work we have done and doubling the maintenance
> for our products running in two Qt versions), or hope that there is some
> solution/initiative from Qt's side to solve this problem.
>
> Is there anybody in the list knowing some sort solution for this?
> Any Qt developer know if it will be ever possible to continue enjoying these
> two wonderful software packages together as it has always been?
>
> Best
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list