QQuickFramebufferObject and fixed pipeline OpenGL
I have managed to integrate our product with QT using QQuickWidget in a Renderer based QObject and QOpenGLFunctions_1_3. It works well, I get everything correctly drawn however I set the drawing is at the highest level because I used QQuickWindow::afterRendering in order to have multiple of those objects.
I let QT to erases background, draws QT component(s) and finally my own components.
Everything works well however the order of drawing is not respected by design and it is necessary to use QQuickFramebufferObject/QQuickFramebufferObject::Renderer now.
I read in the docs, using FBO apparently will respect the order of drawing. It seems so when I try one example or two but:
1- I want to have multiple FBOs in the same window, is there a limit to the number of FBOs ?
2- Is it possible to use OpenGL 1.3 in QQuickFramebufferObject::Renderer::render ?
I think it is possible if the renderer is based of QQuickFramebufferObject::Renderer and QOpenGLFunctions_1_3.
- However what is the call to restore the OpenGL or at least to reset the OpenGL states, it is not crystal clear to me. I tried several things nothing works well enough.
I figure out a way to restore the OpenGL state so the fixed pipeline could be used in render() method:
just call QOpenGLContext::currentContext()->functions()->glUseProgram(0)
in the beginning of QQuickFramebufferObject/QQuickFramebufferObject::Renderer::render() prior to execute my own fixed pipeline calls.
Apparently QT has enabled a shader which has bad effects later on my own fixed pipeline OpenGL calls.
Note: I noticed the first iteration render() was working correctly but the subsequent iterations the result was messed up.