Fix offscreen rendering in QOpenGLWidget
Amends 68a4c5da9a
In a case sharing QOpenGLContext,
offscreen renderings cannot get QOpenGLContext from Rhi.
Fixes: QTBUG-123005
Pick-to: 6.7 6.6 6.5
Change-Id: I9baae5e5c77878885f73ee39df5cd39117e8f1c2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
bb10
parent
f9136fd0db
commit
50c81f5490
|
|
@ -855,9 +855,11 @@ void QOpenGLWidgetPrivate::initialize()
|
|||
|
||||
context = new QOpenGLContext;
|
||||
context->setFormat(requestedFormat);
|
||||
if (contextFromRhi) {
|
||||
context->setShareContext(contextFromRhi);
|
||||
context->setScreen(contextFromRhi->screen());
|
||||
|
||||
QOpenGLContext *shareContext = contextFromRhi ? contextFromRhi : qt_gl_global_share_context();
|
||||
if (shareContext) {
|
||||
context->setShareContext(shareContext);
|
||||
context->setScreen(shareContext->screen());
|
||||
}
|
||||
if (Q_UNLIKELY(!context->create())) {
|
||||
qWarning("QOpenGLWidget: Failed to create context");
|
||||
|
|
|
|||
Loading…
Reference in New Issue