diff --git a/toonz/sources/common/tfx/trenderer.cpp b/toonz/sources/common/tfx/trenderer.cpp index 638e310..60ea393 100644 --- a/toonz/sources/common/tfx/trenderer.cpp +++ b/toonz/sources/common/tfx/trenderer.cpp @@ -1424,8 +1424,6 @@ void TRendererImp::startRendering( QThread::currentThread() == qGuiApp->thread()) { rs.m_offScreenSurface.reset(new QOffscreenSurface()); rs.m_offScreenSurface->setFormat(QSurfaceFormat::defaultFormat()); - rs.m_offScreenSurface->setScreen( - QOpenGLContext::globalShareContext()->screen()); rs.m_offScreenSurface->create(); } diff --git a/toonz/sources/tcomposer/tcomposer.cpp b/toonz/sources/tcomposer/tcomposer.cpp index 5c0bf88..e38633c 100644 --- a/toonz/sources/tcomposer/tcomposer.cpp +++ b/toonz/sources/tcomposer/tcomposer.cpp @@ -564,7 +564,6 @@ static std::pair generateMovie(ToonzScene *scene, const TFilePath &fp, DV_IMPORT_API void initStdFx(); DV_IMPORT_API void initColorFx(); int main(int argc, char *argv[]) { - QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); QApplication app(argc, argv); // Create a QObject destroyed just before app - see Tnz6's main.cpp for diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cpp index 3619742..34f6edd 100644 --- a/toonz/sources/toonz/main.cpp +++ b/toonz/sources/toonz/main.cpp @@ -259,9 +259,6 @@ int main(int argc, char *argv[]) { #if QT_VERSION >= 0x050600 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif - // Enables resource sharing between the OpenGL contexts used by classes like - // QOpenGLWidget and QQuickWidget. - QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); QApplication a(argc, argv); diff --git a/toonz/sources/toonzlib/imagebuilders.cpp b/toonz/sources/toonzlib/imagebuilders.cpp index 5d48b7d..3e25b73 100644 --- a/toonz/sources/toonzlib/imagebuilders.cpp +++ b/toonz/sources/toonzlib/imagebuilders.cpp @@ -277,8 +277,6 @@ TImageP ImageRasterizer::build(int imFlags, void *extData) { std::unique_ptr surface(new QOffscreenSurface()); surface->setFormat(format); - // Enabling Qt::AA_ShareOpenGLContexts attribute in main() - surface->setScreen(QOpenGLContext::globalShareContext()->screen()); surface->create(); TRaster32P ras(d); diff --git a/toonz/sources/toonzlib/plasticdeformerfx.cpp b/toonz/sources/toonzlib/plasticdeformerfx.cpp index 9f3ea0c..2a2b981 100644 --- a/toonz/sources/toonzlib/plasticdeformerfx.cpp +++ b/toonz/sources/toonzlib/plasticdeformerfx.cpp @@ -363,7 +363,8 @@ void PlasticDeformerFx::doCompute(TTile &tile, double frame, // Prepare an OpenGL context context = new QOpenGLContext(); - context->setShareContext(QOpenGLContext::globalShareContext()); + if (QOpenGLContext::currentContext()) + context->setShareContext(QOpenGLContext::currentContext()); context->setFormat(QSurfaceFormat::defaultFormat()); context->create(); context->makeCurrent(info.m_offScreenSurface.get()); diff --git a/toonz/sources/toonzlib/toonzscene.cpp b/toonz/sources/toonzlib/toonzscene.cpp index 60a3ccc..e36d56c 100644 --- a/toonz/sources/toonzlib/toonzscene.cpp +++ b/toonz/sources/toonzlib/toonzscene.cpp @@ -811,8 +811,6 @@ void ToonzScene::renderFrame(const TRaster32P &ras, int row, const TXsheet *xsh, std::unique_ptr surface(new QOffscreenSurface()); surface->setFormat(format); - // Enabling Qt::AA_ShareOpenGLContexts attribute in main() - surface->setScreen(QOpenGLContext::globalShareContext()->screen()); surface->create(); glPushAttrib(GL_ALL_ATTRIB_BITS);