Differences between Canvas3D and QQuickFramebufferObject
Unsolved
QML and Qt Quick
-
Some time ago I asked whether Canvas3D and QQFBO have the same purpose. I was told they do, and I chose Canvas3D of the two, because I preferred to code in JS. But now I hit some pretty blocking problems (described at the end of this question of mine) that led me to consider moving to QQFBO. I'm afraid QQFBO may also have limitations that are problematic for me, so my question is: What exactly are the differences between the two?
I know the two do basically the same thing. I know some differences:
- For Canvas3D you code in JS, for QQFBO you code in C++
- Unlike QQFBO, Every Canvas3D instance has its own OpenGL context, which takes some time to initialize, and which prevents sharing GL resources between several Canvas3Ds.
- Canvas3D puts all my GL commands in a queue and executes them later. I think this is to support multithreading, which might improve performance. Also it saves my commands for later "no-change" repaints, which might improve performance. But there's the side effect that I shouldn't use synchronous GL commands in
onPaintGL()
. - Canvas3D is pretty buggy - gl.colorMask and gl.depthMask break everything, requesting GL ES 3.0 breaks everything, gl.MULTISAMPLE is missing. I have hopes that QQFB will be less buggy, since it's closer to the underlying OpenGL API and since it's an older API.
- With QQFBO I think I have access to the very useful C++ GL classes of Qt such as QOpenGLShaderProgram, while with Canvas3D I have to either write plain GL code, wrap GL in my own classes (as I've done) or use something like THREE.js which has drawbacks.
- With QQFBO one has to override a
synchronize
method his QQFBO::Renderer subclass, and copy data between threads in this method. Canvas3D requires no such boilerplate.
I know of some important similarities too:
- I think both allocate a FBO and make you draw to it, instead of letting you draw directly to the window
- In Canvas3D you can fetch any QML item as an auto-updated texture, with the
createTextureFromSource()
function of theQTCANVAS3D_texture_provider
GL extension. In QQFBO you can do the same, but with another function -textureProvider()
.