Browse Source

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

chirpmodem-v8.0.0
f4exb 11 years ago
parent
commit
b2cd053cdb
  1. 1
      include/gui/glshadertextured.h
  2. 17
      sdrbase/gui/glspectrum.cpp

1
include/gui/glshadertextured.h

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

17
sdrbase/gui/glspectrum.cpp

@ -509,6 +509,10 @@ void GLSpectrum::initializeGL() @@ -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() @@ -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() @@ -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) @@ -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();
}

Loading…
Cancel
Save