mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-05 14:47:50 -04:00
OpenGL modernization: GLSpectrum: use functions from the QOpenGLContext functions exclusively
This commit is contained in:
parent
92a588b060
commit
b2cd053cdb
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QOpenGLTexture>
|
#include <QOpenGLTexture>
|
||||||
|
#include <QOpenGLFunctions>
|
||||||
|
|
||||||
class QOpenGLShaderProgram;
|
class QOpenGLShaderProgram;
|
||||||
class QMatrix4x4;
|
class QMatrix4x4;
|
||||||
|
@ -509,6 +509,10 @@ void GLSpectrum::initializeGL()
|
|||||||
}
|
}
|
||||||
|
|
||||||
connect(glCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, &GLSpectrum::cleanup); // TODO: when migrating to QOpenGLWidget
|
connect(glCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, &GLSpectrum::cleanup); // TODO: when migrating to QOpenGLWidget
|
||||||
|
|
||||||
|
QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions();
|
||||||
|
glFunctions->initializeOpenGLFunctions();
|
||||||
|
|
||||||
//glDisable(GL_DEPTH_TEST);
|
//glDisable(GL_DEPTH_TEST);
|
||||||
m_glShaderSimple.initializeGL();
|
m_glShaderSimple.initializeGL();
|
||||||
m_glShaderLeftScale.initializeGL();
|
m_glShaderLeftScale.initializeGL();
|
||||||
@ -519,8 +523,8 @@ void GLSpectrum::initializeGL()
|
|||||||
|
|
||||||
void GLSpectrum::resizeGL(int width, int height)
|
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;
|
m_changesPending = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,8 +558,9 @@ void GLSpectrum::paintGL()
|
|||||||
glScalef(2.0, -2.0, 1.0);
|
glScalef(2.0, -2.0, 1.0);
|
||||||
glTranslatef(-0.50, -0.5, 0);
|
glTranslatef(-0.50, -0.5, 0);
|
||||||
#endif
|
#endif
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions();
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glFunctions->glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
glFunctions->glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
// paint waterfall
|
// paint waterfall
|
||||||
if (m_displayWaterfall)
|
if (m_displayWaterfall)
|
||||||
@ -2274,11 +2279,11 @@ void GLSpectrum::connectTimer(const QTimer& timer)
|
|||||||
|
|
||||||
void GLSpectrum::cleanup()
|
void GLSpectrum::cleanup()
|
||||||
{
|
{
|
||||||
makeCurrent();
|
//makeCurrent();
|
||||||
m_glShaderSimple.cleanup();
|
m_glShaderSimple.cleanup();
|
||||||
m_glShaderFrequencyScale.cleanup();
|
m_glShaderFrequencyScale.cleanup();
|
||||||
m_glShaderHistogram.cleanup();
|
m_glShaderHistogram.cleanup();
|
||||||
m_glShaderLeftScale.cleanup();
|
m_glShaderLeftScale.cleanup();
|
||||||
m_glShaderWaterfall.cleanup();
|
m_glShaderWaterfall.cleanup();
|
||||||
doneCurrent();
|
//doneCurrent();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user