File tree 2 files changed +10
-7
lines changed
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) :
13
13
{
14
14
m_fboFormat.setAttachment (QOpenGLFramebufferObject::CombinedDepthStencil);
15
15
m_fboFormat.setSamples (m_antialiasingEnabled ? 4 : 0 );
16
-
17
- m_glF.initializeOpenGLFunctions ();
18
16
}
19
17
20
18
PenLayer::~PenLayer ()
@@ -66,11 +64,16 @@ void scratchcpprender::PenLayer::clear()
66
64
if (!m_fbo)
67
65
return ;
68
66
67
+ if (!m_glF) {
68
+ m_glF = std::make_unique<QOpenGLFunctions>();
69
+ m_glF->initializeOpenGLFunctions ();
70
+ }
71
+
69
72
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);
74
77
m_fbo->release ();
75
78
76
79
update ();
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ class PenLayer : public IPenLayer
50
50
std::unique_ptr<QOpenGLFramebufferObject> m_fbo;
51
51
std::unique_ptr<QOpenGLPaintDevice> m_paintDevice;
52
52
QOpenGLFramebufferObjectFormat m_fboFormat;
53
- QOpenGLFunctions m_glF;
53
+ std::unique_ptr< QOpenGLFunctions> m_glF;
54
54
};
55
55
56
56
} // namespace scratchcpprender
You can’t perform that action at this time.
0 commit comments