File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,6 @@ PenLayer::PenLayer(QNanoQuickItem *parent) :
1313{
1414 m_fboFormat.setAttachment (QOpenGLFramebufferObject::CombinedDepthStencil);
1515 m_fboFormat.setSamples (m_antialiasingEnabled ? 4 : 0 );
16-
17- m_glF.initializeOpenGLFunctions ();
1816}
1917
2018PenLayer::~PenLayer ()
@@ -66,11 +64,16 @@ void scratchcpprender::PenLayer::clear()
6664 if (!m_fbo)
6765 return ;
6866
67+ if (!m_glF) {
68+ m_glF = std::make_unique<QOpenGLFunctions>();
69+ m_glF->initializeOpenGLFunctions ();
70+ }
71+
6972 m_fbo->bind ();
70- m_glF. glDisable (GL_SCISSOR_TEST);
71- m_glF. glClearColor (0 .0f , 0 .0f , 0 .0f , 0 .0f );
72- m_glF. glClear (GL_COLOR_BUFFER_BIT);
73- m_glF. glEnable (GL_SCISSOR_TEST);
73+ m_glF-> glDisable (GL_SCISSOR_TEST);
74+ m_glF-> glClearColor (0 .0f , 0 .0f , 0 .0f , 0 .0f );
75+ m_glF-> glClear (GL_COLOR_BUFFER_BIT);
76+ m_glF-> glEnable (GL_SCISSOR_TEST);
7477 m_fbo->release ();
7578
7679 update ();
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ class PenLayer : public IPenLayer
5050 std::unique_ptr<QOpenGLFramebufferObject> m_fbo;
5151 std::unique_ptr<QOpenGLPaintDevice> m_paintDevice;
5252 QOpenGLFramebufferObjectFormat m_fboFormat;
53- QOpenGLFunctions m_glF;
53+ std::unique_ptr< QOpenGLFunctions> m_glF;
5454};
5555
5656} // namespace scratchcpprender
You can’t perform that action at this time.
0 commit comments