diff --git a/sdrgui/gui/glshadersimple.cpp b/sdrgui/gui/glshadersimple.cpp index ef6b7244a..f52c245da 100644 --- a/sdrgui/gui/glshadersimple.cpp +++ b/sdrgui/gui/glshadersimple.cpp @@ -51,6 +51,10 @@ void GLShaderSimple::initializeGL(int majorVersion, int minorVersion) if (!m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, m_fragmentShaderSourceColored)) { qDebug() << "GLShaderSimple::initializeGL: error in fragment shader: " << m_program->log(); } + + m_vao = new QOpenGLVertexArrayObject(); + m_vao->create(); + m_vao->bind(); } else { @@ -74,9 +78,6 @@ void GLShaderSimple::initializeGL(int majorVersion, int minorVersion) m_colorLoc = m_program->uniformLocation("uColour"); if (m_vao) { - m_vao = new QOpenGLVertexArrayObject(); - m_vao->create(); - m_vao->bind(); m_verticesBuf = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer); m_verticesBuf->setUsagePattern(QOpenGLBuffer::DynamicDraw); m_verticesBuf->create(); diff --git a/sdrgui/gui/glshadertextured.cpp b/sdrgui/gui/glshadertextured.cpp index e23f94884..b9e2a4db0 100644 --- a/sdrgui/gui/glshadertextured.cpp +++ b/sdrgui/gui/glshadertextured.cpp @@ -32,9 +32,9 @@ GLShaderTextured::GLShaderTextured() : m_verticesBuf(nullptr), m_textureCoordsBuf(nullptr), m_texture(nullptr), + m_textureId(0), m_vertexLoc(0), m_texCoordLoc(0), - m_textureId(0), m_matrixLoc(0), m_textureLoc(0), m_useImmutableStorage(true) @@ -60,6 +60,10 @@ void GLShaderTextured::initializeGL(int majorVersion, int minorVersion) if (!m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, m_fragmentShaderSourceTextured)) { qDebug() << "GLShaderTextured::initializeGL: error in fragment shader: " << m_program->log(); } + + m_vao = new QOpenGLVertexArrayObject(); + m_vao->create(); + m_vao->bind(); } else { @@ -85,9 +89,6 @@ void GLShaderTextured::initializeGL(int majorVersion, int minorVersion) m_textureLoc = m_program->uniformLocation("uTexture"); if (m_vao) { - m_vao = new QOpenGLVertexArrayObject(); - m_vao->create(); - m_vao->bind(); m_verticesBuf = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer); m_verticesBuf->setUsagePattern(QOpenGLBuffer::DynamicDraw); m_verticesBuf->create();