Skip to content

Commit d180546

Browse files
committed
PenLayer: Initialize GL functions in setEngine()
1 parent bb93dc9 commit d180546

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/penlayer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ void PenLayer::setEngine(libscratchcpp::IEngine *newEngine)
5656
if (!m_painter)
5757
m_painter = std::make_unique<QNanoPainter>();
5858

59+
if (!m_glF) {
60+
m_glF = std::make_unique<QOpenGLFunctions>();
61+
m_glF->initializeOpenGLFunctions();
62+
}
63+
5964
clear();
6065
}
6166

@@ -67,11 +72,6 @@ void scratchcpprender::PenLayer::clear()
6772
if (!m_fbo)
6873
return;
6974

70-
if (!m_glF) {
71-
m_glF = std::make_unique<QOpenGLFunctions>();
72-
m_glF->initializeOpenGLFunctions();
73-
}
74-
7575
m_fbo->bind();
7676
m_glF->glDisable(GL_SCISSOR_TEST);
7777
m_glF->glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

0 commit comments

Comments
 (0)