diff --git a/src/platform/qt/DisplayGL.cpp b/src/platform/qt/DisplayGL.cpp index 9f5729a67..3b1c2a695 100644 --- a/src/platform/qt/DisplayGL.cpp +++ b/src/platform/qt/DisplayGL.cpp @@ -887,12 +887,20 @@ void PainterGL::setShaders(struct VDir* dir) { return; } #if defined(BUILD_GLES2) || defined(BUILD_GLES3) + if (!m_started) { + makeCurrent(); + } + if (m_shader.passes) { mGLES2ShaderDetach(reinterpret_cast(m_backend)); mGLES2ShaderFree(&m_shader); } mGLES2ShaderLoad(&m_shader, dir); mGLES2ShaderAttach(reinterpret_cast(m_backend), static_cast(m_shader.passes), m_shader.nPasses); + + if (!m_started) { + m_gl->doneCurrent(); + } #endif } @@ -901,10 +909,18 @@ void PainterGL::clearShaders() { return; } #if defined(BUILD_GLES2) || defined(BUILD_GLES3) + if (!m_started) { + makeCurrent(); + } + if (m_shader.passes) { mGLES2ShaderDetach(reinterpret_cast(m_backend)); mGLES2ShaderFree(&m_shader); } + + if (!m_started) { + m_gl->doneCurrent(); + } #endif }