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

OpenGL modernization: GLSpectrum: use functions from the QOpenGLContext functions exclusively

This commit is contained in:
f4exb 2016-03-06 12:15:40 +01:00
parent 92a588b060
commit b2cd053cdb
2 changed files with 12 additions and 6 deletions

View File

@ -23,6 +23,7 @@
#include <QString>
#include <QOpenGLTexture>
#include <QOpenGLFunctions>
class QOpenGLShaderProgram;
class QMatrix4x4;

View File

@ -509,6 +509,10 @@ void GLSpectrum::initializeGL()
}
connect(glCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, &GLSpectrum::cleanup); // TODO: when migrating to QOpenGLWidget
QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions();
glFunctions->initializeOpenGLFunctions();
//glDisable(GL_DEPTH_TEST);
m_glShaderSimple.initializeGL();
m_glShaderLeftScale.initializeGL();
@ -519,8 +523,8 @@ void GLSpectrum::initializeGL()
void GLSpectrum::resizeGL(int width, int height)
{
glViewport(0, 0, width, height);
QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions();
glFunctions->glViewport(0, 0, width, height);
m_changesPending = true;
}
@ -554,8 +558,9 @@ void GLSpectrum::paintGL()
glScalef(2.0, -2.0, 1.0);
glTranslatef(-0.50, -0.5, 0);
#endif
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions();
glFunctions->glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glFunctions->glClear(GL_COLOR_BUFFER_BIT);
// paint waterfall
if (m_displayWaterfall)
@ -2274,11 +2279,11 @@ void GLSpectrum::connectTimer(const QTimer& timer)
void GLSpectrum::cleanup()
{
makeCurrent();
//makeCurrent();
m_glShaderSimple.cleanup();
m_glShaderFrequencyScale.cleanup();
m_glShaderHistogram.cleanup();
m_glShaderLeftScale.cleanup();
m_glShaderWaterfall.cleanup();
doneCurrent();
//doneCurrent();
}