QQuickFramebufferObject::Renderer and FBO reading
I'm trying to port a QT widgets application to QML. My application has an OpenGL view where i draw some 2D graphics.
In the old application i used a FrameBufferObject(FBO) for object picking. This was done by having an extra render pass which painted each Object in the scene with a distinct color. Then I used glReadPixels on the FBO acquire the color and identifying the object. This was done in the mouseMove event of the QT Widget.
Hoever in QML it seems that the OpenGL code completely separated from the GUI code, which is sort of nice, but now I face the problem on how to exchange information between the QQuickFramebufferObject and the QQuickFramebufferObject::Renderer. Its the renderer which owns the FBO and the mouse events belong to QQuickFramebufferObject. It seems like the two objects lives in separate threads. What is the procedure for passing mouse coordinates to the renderer and then return a pixel from the picking FBO?
I tried a direct call, glReadPixels, however this does not work. I also tried to copy the FBO data into a shared buffer on each render pass, but that causes the application to crash.