[Interest] Displaying QWidgets into an OpenGL render thread
Samuel Rødal
samuel.rodal at nokia.com
Mon May 14 12:06:22 CEST 2012
On 05/11/2012 09:09 PM, ext Pierre-Étienne Messier wrote:
> Hello all,
>
> I wrote a small demo application using a OpenGL render thread similar to
> the solution presented in QQ
> (http://doc.qt.nokia.com/qq/qq06-glimpsing.html#writingmultithreadedglapplications
> / http://mih.voxindeserto.de/threadedcube.html) which runs fine.
>
> Now, I'd like to render QWidgets (QDialog for instance) on the OpenGL
> scene, as presented in QQ
> (http://doc.qt.nokia.com/qq/qq26-openglcanvas.html). In fact, I do not
> require an QGraphicsView in the app, it's just the only solution I see
> right now to display QWidgets on the OpenGL viewport.
>
> In the first threaded solution, I fully have control over the OpenGL
> context. However, in the second solution, The QGraphicsView calls
> automagically makeCurrent() and I wonder how can this could work with my
> render thread. Can the threading improvements in QGLWidget in 4.8 solve
> this issue (we are still on 4.7)?
>
> Thank you and have a nice day!
>
> Pierre-Étienne Messier
I don't think you can get QGraphicsView to render in another thread.
Another approach might be to do the heavy OpenGL rendering in a separate
thread, into an FBO, that you then render as part of the QGraphicsView
scene or in QGraphicsViewdrawBackground().
With QQuickView in Qt 5 on the other hand, we're aiming to do the
rendering by default in a separate thread, including any custom OpenGL
rendering with QtQuick 2 items on top.
--
Samuel
More information about the Interest
mailing list