diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-09-23 17:40:27 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-09-24 12:51:37 +0000 |
commit | b46ffbca0cfad41599873d4ca19dc79167c3955f (patch) | |
tree | e8176dee68e341de8efe82eb442ce883f7950957 /src/gui/painting | |
parent | bf2c9fd2fdff2760f3798fd1584f2da330266c46 (diff) |
Fix up QOpenGLWidget transparency support
The glColorMask call was troublesome. In addition, the Qt::WA_TranslucentBackground
was misinterpreted and recommended misleadingly in the documentation. The hellogl2
example's --transparent argument was disfunctional in practice.
Replace glColorMask with glBlendFuncSeparate. The hellogl2 example and the docs are
now corrected wrt enabling semi-transparency in a QOpenGLWidget that is not a top-level
(which is the most common case).
Task-number: QTBUG-47276
Change-Id: I6f40e732d455f5efcf158649ac9a52ff9f240e85
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qplatformbackingstore.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index e765a9e402..c86fdebea5 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -300,11 +300,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i } funcs->glEnable(GL_BLEND); - funcs->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - // Do not write out alpha. We need blending, but only for RGB. The toplevel may have - // alpha enabled in which case blending (writing out < 1.0 alpha values) would lead to - // semi-transparency even when it is not wanted. - funcs->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); + funcs->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE); // Backingstore texture with the normal widgets. GLuint textureId = 0; @@ -364,7 +360,6 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i blit(textures, i, window, deviceWindowRect, d_ptr->blitter); } - funcs->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); funcs->glDisable(GL_BLEND); d_ptr->blitter->release(); |