QOpenGLWidget: Play nice with empty paintGL

Applications that do not override paintGL() (may happen in some test code)
will not perform any GL rendering, not even clearing. This is fine, but
to be safe we need to do a clear right after creating the FBO in order to
prevent showing garbage.

Task-number: QTBUG-38327
Change-Id: If062901bb18724f961e41856085470e37b49abbe
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Laszlo Agocs 2014-09-16 12:36:02 +02:00
parent 4aba2d07d2
commit 5d5de7a97f

View File

@ -563,6 +563,7 @@ void QOpenGLWidgetPrivate::recreateFbo()
resolvedFbo = new QOpenGLFramebufferObject(deviceSize);
fbo->bind();
context->functions()->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
paintDevice->setSize(deviceSize);
paintDevice->setDevicePixelRatio(q->devicePixelRatio());