[Interest] Q[Open]GLWidget and separate render thread
Sean Harmer
sean.harmer at kdab.com
Sun Oct 11 19:55:12 CEST 2015
Do you need widgets composited over your GL content? If not just use
QWindow + QOpenGLContext and implement a loop by way of posting an event
to your render thread following the blocking call to swapBuffers() that
kicks off the next frame of drawing. The window can be inserted into
your widget hierarchy using QWidget::createWindowContainer().
If you do want your controls of some sort overlaid over your GL content
then you can use QQuickView and connect to its beforeRendering() signal
using a direct connection to do your rendering in QQ2's render thread by
borrowing its context.
Aternatively you can use QQuickFramebufferObject to draw your GL content
into an FBO that then gets composited into the QQ2 scene.
Cheers,
Sean
On 05/10/2015 16:01, Matthew Woehlke wrote:
> I have a requirement for a project to provide a very high and consistent
> frame rate of GL rendering. We are otherwise using Qt for the
> application and would prefer to continue to do so. The only way we have
> been able to determine to achieve the necessary render requirements is
> to have a separate, dedicated thread that is constantly rendering and
> performing a vsync-synchronous buffer swap. For various reasons
> (particularly that the buffer swap will be blocking), this can't be done
> in the main UI thread.
>
> Does anyone have any guidelines / tutorials / examples on how to
> implement GL rendering in a separate render thread with a Qt 5.x GL widget?
>
> (Also... we are currently using distro-provided Qt which is 5.2/5.3,
> i.e. no QOpenGLWidget. We can upgrade if needed, but it may require
> building Qt ourselves, so we'd prefer not to without good reason. Does
> anyone know if a separate render thread is possible with QGLWidget,
> and/or if there are other issues that have been fixed that would mandate
> updating to a newer Qt version?)
>
--
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts
More information about the Interest
mailing list