summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qopenglwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qopenglwidget.cpp')
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index 451b18d8d3..bc5ca21b97 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -788,10 +788,12 @@ void QOpenGLWidgetPrivate::initialize()
if (initialized)
return;
- // Get our toplevel's context with which we will share in order to make the
- // texture usable by the underlying window's backingstore.
+ // If no global shared context get our toplevel's context with which we
+ // will share in order to make the texture usable by the underlying window's backingstore.
QWidget *tlw = q->window();
- QOpenGLContext *shareContext = get(tlw)->shareContext();
+ QOpenGLContext *shareContext = qt_gl_global_share_context();
+ if (!shareContext)
+ shareContext = get(tlw)->shareContext();
// If shareContext is null, showing content on-screen will not work.
// However, offscreen rendering and grabFramebuffer() will stay fully functional.