Redirect the default FBO correctly with QQuickWidget
Similarly to QOpenGLWidget, functions like QOpenGLFramebufferObject::bindDefault()
should bind the QQuickWidget's FBO, not 0, while rendering the scene graph.
This becomes particularly important on platforms with surfaceless context support.
Here offscreen surfaces are not backed by any surface. Therefore any OpenGL operation
accessing the current draw framebuffer with FBO 0 bound may potentially crash, as there
is no draw framebuffer at all.
The distance field glyph cache exhibits this issue when running with EGL on Mesa:
glViewport crashes when we render via QQuickWidget and the current framebuffer is reset
to 0. The problem goes away when the code changed is to use bindDefault() - as it should have
anyhow - and QQuickWidget is enhanced to communicate the "default" framebuffer to QOpenGLContext,
just like QOpenGLWidget does.
Task-number: QTBUG-46415
Task-number: QTBUG-43269
Change-Id: I35fe375a0870dadecc4a074dfdec122c6a4c92ab
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>