1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

OpenGL modernization: GLScope: make sure openGL functions are called through QOpenGLFunctions

This commit is contained in:
f4exb 2016-03-06 10:00:13 +01:00
parent cefb6145a2
commit 264022d2ca
2 changed files with 12 additions and 6 deletions

View File

@ -20,6 +20,7 @@
#include <QPainter>
#include <QMouseEvent>
#include <QOpenGLContext>
#include <QOpenGLFunctions>
#include "gui/glscope.h"
#include "dsp/dspengine.h"
@ -256,7 +257,10 @@ void GLScope::initializeGL()
connect(glCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, &GLScope::cleanup); // TODO: when migrating to QOpenGLWidget
glDisable(GL_DEPTH_TEST);
QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions();
glFunctions->initializeOpenGLFunctions();
//glDisable(GL_DEPTH_TEST);
m_glShaderSimple.initializeGL();
m_glShaderLeft1Scale.initializeGL();
m_glShaderBottom1Scale.initializeGL();
@ -267,7 +271,8 @@ void GLScope::initializeGL()
void GLScope::resizeGL(int width, int height)
{
glViewport(0, 0, width, height);
QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions();
glFunctions->glViewport(0, 0, width, height);
m_configChanged = true;
}
@ -289,9 +294,10 @@ void GLScope::paintGL()
// glPushMatrix();
// glScalef(2.0, -2.0, 1.0);
// glTranslatef(-0.50, -0.5, 0);
QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions();
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
glFunctions->glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glFunctions->glClear(GL_COLOR_BUFFER_BIT);
// I - primary display
@ -1181,7 +1187,7 @@ void GLScope::paintGL()
}
} // Both displays or secondary display only
glPopMatrix();
// glPopMatrix();
m_dataChanged = false;
m_mutex.unlock();
}

View File

@ -509,7 +509,7 @@ void GLSpectrum::initializeGL()
}
connect(glCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, &GLSpectrum::cleanup); // TODO: when migrating to QOpenGLWidget
glDisable(GL_DEPTH_TEST);
//glDisable(GL_DEPTH_TEST);
m_glShaderSimple.initializeGL();
m_glShaderLeftScale.initializeGL();
m_glShaderFrequencyScale.initializeGL();