qt5base-lts/src/openglwidgets
Laszlo Agocs 7fbccd1900 QOpenGLWidget: Call glClear in the default paintGL implementation
Amends 8cc8bbb466.

With the referenced patch framebuffer invalidation is preferred
over clearing with a wider range of OpenGL implementations.
This is good and is in line with the documentation. If an existing
application does not do glClear() in their reimplemented paintGL(),
that we cannot fix, and the docs never actually promised that a
glClear() is done automatically.

However, there is a special case: when one does not reimplement
paintGL(). A QOpenGLWidget is expected to be usable without
reimplementing any of its virtuals (i.e., QOpenGLWidget is
constructible as-is without subclassing). It is then ideal
if this does not lead to showing rendering artifacts due to
having potentially random content in the (invalidated,
not cleared) color buffer. This problem was never encountered
before due to hitting the invalidate-instead-of-clear code path
on a limited set of platforms (like with OpenGL ES) only.

Do a glClear() in paintGL(). This won't effect the vast majority
of applications, that reimplement this function, but plays nice
for when it is not.

It is in fact also in line with Qt 4's QGLWidget: that also used to
do a glClear() in the default paintGL() implementation.

Change-Id: I117ce1d3340f6d4d82cde1f52769a3b13ce367fb
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-09-04 11:46:29 +02:00
..
CMakeLists.txt Enable QT_NO_CONTEXTLESS_CONNECT for most of QtBase 2023-07-11 22:44:29 +02:00
qopenglwidget.cpp QOpenGLWidget: Call glClear in the default paintGL implementation 2023-09-04 11:46:29 +02:00
qopenglwidget.h Add missing underlying type and Q_ENUM to QOpenGLWidget enums 2023-01-26 17:39:10 +01:00
qtopenglwidgetsglobal.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00