[Interest] Running code in the scene graph renderer thread

Samuel Rødal samuel.rodal at digia.com
Wed Apr 3 10:56:10 CEST 2013


On 04/02/2013 10:21 PM, Luca Carlon wrote:
> Hi! I'm implementing a plugin for Qt Multimedia for playing video and
> audio using hardware acceleration. When opening a content which includes
> video, I need to instantiate an OpenGL texture and an EGLImageKHR. To do
> this I need to be in the thread with the current OpenGL context, which
> should be the renderer thread.
>
> I did this in a custom QML component (in the updatePaintNode method),
> and everything is working correctly: but how do I execute my code in the
> renderer thread of the scene graph from a Qt Multimedia plugin? What
> options do I have?
>
> I quickly read the Qt Multimedia plugin for Android, but that is a
> little different because the texture is instantiated by the
> SurfaceTexture java class.

If you can get access to the QWindow you can qobject_cast to check that 
it's a QQuickWindow. In that case you can connect to the 
beforeRendering() signal of the QQuickWindow using a 
Qt::DirectConnection, which will cause your slot to be executed on the 
render thread before the rendering of a frame.

--
Samuel




More information about the Interest mailing list