Browse Source

Create VAOs properly

chirpmodem-v8.0.0
Jon Beniston 5 years ago
parent
commit
0a91c30038
  1. 7
      sdrgui/gui/glshadersimple.cpp
  2. 9
      sdrgui/gui/glshadertextured.cpp

7
sdrgui/gui/glshadersimple.cpp

@ -51,6 +51,10 @@ void GLShaderSimple::initializeGL(int majorVersion, int minorVersion) @@ -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) @@ -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();

9
sdrgui/gui/glshadertextured.cpp

@ -32,9 +32,9 @@ GLShaderTextured::GLShaderTextured() : @@ -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) @@ -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) @@ -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();

Loading…
Cancel
Save