From 7ce85485f6d9d3fcb7029a7b5a9c46134a1cc8b3 Mon Sep 17 00:00:00 2001 From: Jeremy Bullock Date: Nov 16 2017 06:49:10 +0000 Subject: Merge pull request #1569 from shun-iwasawa/fix_plastic_tool_osx Fix Vector Level Disappearing with Plastic Tool in OSX --- diff --git a/toonz/sources/toonzlib/imagebuilders.cpp b/toonz/sources/toonzlib/imagebuilders.cpp index 9c24d4d..767637a 100644 --- a/toonz/sources/toonzlib/imagebuilders.cpp +++ b/toonz/sources/toonzlib/imagebuilders.cpp @@ -270,8 +270,6 @@ TImageP ImageRasterizer::build(int imFlags, void *extData) { TVectorRenderData rd(TTranslation(-off.x, -off.y), TRect(TPoint(0, 0), d), vpalette, 0, true, true); - TGlContext oldContext = tglGetCurrentContext(); - // this is too slow. { QSurfaceFormat format; @@ -279,12 +277,10 @@ 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(); - std::unique_ptr context(new QOpenGLContext()); - context->create(); - context->makeCurrent(surface.get()); - TRaster32P ras(d); glPushAttrib(GL_ALL_ATTRIB_BITS); @@ -336,9 +332,6 @@ TImageP ImageRasterizer::build(int imFlags, void *extData) { glPopAttrib(); - context->doneCurrent(); - tglMakeCurrent(oldContext); - TRasterImageP ri = TRasterImageP(ras); ri->setOffset(off + ras->getCenter());