Fix macOS mesh on subscenes with clipping masks

This commit is contained in:
manongjohn 2023-10-19 15:44:47 -04:00
parent 6d5f58ce0d
commit f6960a8ceb
2 changed files with 6 additions and 3 deletions

View file

@ -192,15 +192,18 @@ DrawableTextureDataP texture_utils::getTextureData(const TXsheet *xsh,
xsh->getPlacement(xsh->getStageObjectTree()->getCurrentCameraId(), frame);
bbox = (cameraAff.inv() * bbox).enlarge(1.0);
// Render the xsheet on the specified bbox
// Render the xsheet on the specified bbox
bool masked = TStencilControl::instance()->isMaskEnabled();
#ifdef MACOSX
// Must move masks aside when building texture
if (masked) TStencilControl::instance()->stashMask();
xsh->getScene()->renderFrame(tex, frame, xsh, bbox, TAffine());
if (masked) TStencilControl::instance()->restoreMask();
#else
// The call below will change context (I know, it's a shame :( )
TGlContext currentContext = tglGetCurrentContext();
{
tglDoneCurrent(currentContext);
bool masked = TStencilControl::instance()->isMaskEnabled();
// Must move masks aside when building texture
if (masked) TStencilControl::instance()->stashMask();
xsh->getScene()->renderFrame(tex, frame, xsh, bbox, TAffine());

View file

@ -812,7 +812,7 @@ void ToonzScene::renderFrame(const TRaster32P &ras, int row, const TXsheet *xsh,
#ifdef MACOSX
std::unique_ptr<QOpenGLFramebufferObject> fb(
new QOpenGLFramebufferObject(ras->getLx(), ras->getLy()));
fb->setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
fb->bind();
assert(glGetError() == GL_NO_ERROR);