From 4cdaf0fe54bbd014ecd956faa93105aeb7df5d6f Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 6 Mar 2016 16:39:28 +0100 Subject: [PATCH] OpenGL modernization: removed GL_DEPRECTATED blocks entirely --- include/gui/glscope.h | 17 - include/gui/glspectrum.h | 26 -- sdrbase/gui/glscope.cpp | 746 ++----------------------------------- sdrbase/gui/glspectrum.cpp | 623 +------------------------------ 4 files changed, 57 insertions(+), 1355 deletions(-) diff --git a/include/gui/glscope.h b/include/gui/glscope.h index 24c54ba58..991e66cdb 100644 --- a/include/gui/glscope.h +++ b/include/gui/glscope.h @@ -157,23 +157,6 @@ private: int m_displayGridIntensity; int m_displayTraceIntensity; -#ifdef GL_DEPRECATED - QRectF m_glLeft1ScaleRect; - QRectF m_glRight1ScaleRect; - QRectF m_glLeft2ScaleRect; - QRectF m_glBot1ScaleRect; - QRectF m_glBot2ScaleRect; - bool m_left1ScaleTextureAllocated; - bool m_left2ScaleTextureAllocated; - bool m_bot1ScaleTextureAllocated; - bool m_bot2ScaleTextureAllocated; - bool m_powerOverlayTextureAllocated1; - GLuint m_left1ScaleTexture; - GLuint m_left2ScaleTexture; - GLuint m_bot1ScaleTexture; - GLuint m_bot2ScaleTexture; - GLuint m_powerOverlayTexture1; -#endif ScaleEngine m_x1Scale; ScaleEngine m_x2Scale; diff --git a/include/gui/glspectrum.h b/include/gui/glspectrum.h index a13dfc900..981971310 100644 --- a/include/gui/glspectrum.h +++ b/include/gui/glspectrum.h @@ -74,10 +74,6 @@ public: private: struct ChannelMarkerState { ChannelMarker* m_channelMarker; -#ifdef GL_DEPRECATED - QRectF m_glRect; - QRectF m_glRectDsb; -#endif QMatrix4x4 m_glMatrixWaterfall; QMatrix4x4 m_glMatrixDsbWaterfall; QMatrix4x4 m_glMatrixFreqScale; @@ -88,10 +84,6 @@ private: ChannelMarkerState(ChannelMarker* channelMarker) : m_channelMarker(channelMarker) -#ifdef GL_DEPRECATED - m_glRect(), - m_glRectDsb() -#endif { } }; QList m_channelMarkerStates; @@ -134,14 +126,6 @@ private: QPixmap m_leftMarginPixmap; QPixmap m_frequencyPixmap; -#ifdef GL_DEPRECATED - bool m_leftMarginTextureAllocated; - GLuint m_leftMarginTexture; - QRectF m_glLeftScaleRect; - bool m_frequencyTextureAllocated; - GLuint m_frequencyTexture; - QRectF m_glFrequencyScaleRect; -#endif ScaleEngine m_timeScale; ScaleEngine m_powerScale; ScaleEngine m_frequencyScale; @@ -152,11 +136,6 @@ private: QRgb m_waterfallPalette[240]; QImage* m_waterfallBuffer; int m_waterfallBufferPos; -#ifdef GL_DEPRECATED - bool m_waterfallTextureAllocated; - GLuint m_waterfallTexture; - QRectF m_glWaterfallRect; -#endif int m_waterfallTextureHeight; int m_waterfallTexturePos; QMatrix4x4 m_glWaterfallBoxMatrix; @@ -167,11 +146,6 @@ private: QImage* m_histogramBuffer; quint8* m_histogram; quint8* m_histogramHoldoff; -#ifdef GL_DEPRECATED - bool m_histogramTextureAllocated; - GLuint m_histogramTexture; - QRectF m_glHistogramRect; -#endif int m_histogramHoldoffBase; int m_histogramHoldoffCount; int m_histogramLateHoldoff; diff --git a/sdrbase/gui/glscope.cpp b/sdrbase/gui/glscope.cpp index 4c13a93c0..172657d7c 100644 --- a/sdrbase/gui/glscope.cpp +++ b/sdrbase/gui/glscope.cpp @@ -68,13 +68,6 @@ GLScope::GLScope(QWidget* parent) : m_prevArg(0), m_displayGridIntensity(5), m_displayTraceIntensity(50), -#ifdef GL_DEPRECATED - m_left1ScaleTextureAllocated(false), - m_left2ScaleTextureAllocated(false), - m_bot1ScaleTextureAllocated(false), - m_bot2ScaleTextureAllocated(false), - m_powerOverlayTextureAllocated1(false), -#endif m_powerOverlayFont(font()) { setAttribute(Qt::WA_OpaquePaintEvent); @@ -315,11 +308,7 @@ void GLScope::paintGL() emit traceSizeChanged((int) m_displayTrace->size()); } -// glPushMatrix(); -// glScalef(2.0, -2.0, 1.0); -// glTranslatef(-0.50, -0.5, 0); QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions(); - glFunctions->glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glFunctions->glClear(GL_COLOR_BUFFER_BIT); @@ -328,26 +317,6 @@ void GLScope::paintGL() if ((m_displays == DisplayBoth) || (m_displays == DisplayFirstOnly)) { // draw rect around -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glScopeRect1.x(), m_glScopeRect1.y(), 0); - glScalef(m_glScopeRect1.width(), m_glScopeRect1.height(), 1); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glLineWidth(1.0f); - glColor4f(1, 1, 1, 0.5); - - glBegin(GL_LINE_LOOP); - glVertex2f(1, 1); - glVertex2f(0, 1); - glVertex2f(0, 0); - glVertex2f(1, 0); - glEnd(); - - glDisable(GL_BLEND); - glPopMatrix(); -#else { GLfloat q3[] { 1, 1, @@ -360,7 +329,6 @@ void GLScope::paintGL() m_glShaderSimple.drawContour(m_glScopeMatrix1, color, q3, 4); } -#endif // paint grid const ScaleEngine::TickList* tickList; @@ -369,36 +337,6 @@ void GLScope::paintGL() // Horizontal Y1 tickList = &m_y1Scale.getTickList(); -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glScopeRect1.x(), m_glScopeRect1.y(), 0); - glScalef(m_glScopeRect1.width(), m_glScopeRect1.height(), 1); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glLineWidth(1.0f); - - if (m_mode == ModeIQPolar) { - glColor4f(1, 1, 0.25f, m_displayGridIntensity / 100.0); - } else { - glColor4f(1, 1, 1, m_displayGridIntensity / 100.0); - } - - for(int i= 0; i < tickList->count(); i++) { - tick = &(*tickList)[i]; - if(tick->major) { - if(tick->textSize > 0) { - float y = 1 - (tick->pos / m_y1Scale.getSize()); - glBegin(GL_LINE_LOOP); - glVertex2f(0, y); - glVertex2f(1, y); - glEnd(); - } - } - } - - glPopMatrix(); -#else { GLfloat q3[4*tickList->count()]; int effectiveTicks = 0; @@ -425,32 +363,7 @@ void GLScope::paintGL() QVector4D color(1.0f, 1.0f, blue, (float) m_displayGridIntensity / 100.0f); m_glShaderSimple.drawSegments(m_glScopeMatrix1, color, q3, 2*effectiveTicks); } -#endif -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glScopeRect1.x(), m_glScopeRect1.y(), 0); - glScalef(m_glScopeRect1.width(), m_glScopeRect1.height(), 1); - - // Vertical X1 - glColor4f(1, 1, 1, m_displayGridIntensity / 100.0); - tickList = &m_x1Scale.getTickList(); - - for(int i= 0; i < tickList->count(); i++) { - tick = &(*tickList)[i]; - if(tick->major) { - if(tick->textSize > 0) { - float x = tick->pos / m_x1Scale.getSize(); - glBegin(GL_LINE_LOOP); - glVertex2f(x, 0); - glVertex2f(x, 1); - glEnd(); - } - } - } - - glPopMatrix(); -#else { // Vertical X1 tickList = &m_x1Scale.getTickList(); @@ -474,33 +387,8 @@ void GLScope::paintGL() QVector4D color(1.0f, 1.0f, 1.0f, (float) m_displayGridIntensity / 100.0f); m_glShaderSimple.drawSegments(m_glScopeMatrix1, color, q3, 2*effectiveTicks); } -#endif // paint left #1 scale -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glLeft1ScaleRect.x(), m_glLeft1ScaleRect.y(), 0); - glScalef(m_glLeft1ScaleRect.width(), m_glLeft1ScaleRect.height(), 1); - glBindTexture(GL_TEXTURE_2D, m_left1ScaleTexture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glEnable(GL_TEXTURE_2D); - - glBegin(GL_QUADS); - glTexCoord2f(0, 1); - glVertex2f(0, 1); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(1, 0); - glVertex2f(1, 0); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glEnd(); - glDisable(GL_TEXTURE_2D); - glPopMatrix(); -#else { GLfloat vtx1[] = { 0, 1, @@ -517,34 +405,8 @@ void GLScope::paintGL() m_glShaderLeft1Scale.drawSurface(m_glLeft1ScaleMatrix, tex1, vtx1, 4); } -#endif // paint bottom #1 scale -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glBot1ScaleRect.x(), m_glBot1ScaleRect.y(), 0); - glScalef(m_glBot1ScaleRect.width(), m_glBot1ScaleRect.height(), 1); - glBindTexture(GL_TEXTURE_2D, m_bot1ScaleTexture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glEnable(GL_TEXTURE_2D); - - glBegin(GL_QUADS); - glTexCoord2f(0, 1); - glVertex2f(0, 1); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(1, 0); - glVertex2f(1, 0); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glEnd(); - - glDisable(GL_TEXTURE_2D); - glPopMatrix(); -#else { GLfloat vtx1[] = { 0, 1, @@ -561,7 +423,6 @@ void GLScope::paintGL() m_glShaderBottom1Scale.drawSurface(m_glBot1ScaleMatrix, tex1, vtx1, 4); } -#endif // paint trigger level #1 if ((m_triggerChannel == ScopeVis::TriggerChannelI) @@ -572,34 +433,6 @@ void GLScope::paintGL() float posLimit = 1.0 / m_amp1; float negLimit = -1.0 / m_amp1; -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glScopeRect1.x(), m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0, 0); - glScalef(m_glScopeRect1.width(), -(m_glScopeRect1.height() / 2) * m_amp1, 1); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - //glEnable(GL_LINE_SMOOTH); - glLineWidth(1.0f); - glColor4f(0, 1, 0, 0.4); - - glBegin(GL_LINE_LOOP); - - if ((m_triggerChannel == ScopeVis::TriggerChannelI) - || (m_triggerChannel == ScopeVis::TriggerMagLin) - || (m_triggerChannel == ScopeVis::TriggerMagDb)) - { - if ((m_triggerLevelDis1 > negLimit) && (m_triggerLevelDis1 < posLimit)) - { - glVertex2f(0, m_triggerLevelDis1); - glVertex2f(1, m_triggerLevelDis1); - } - } - - glEnd(); - - //glDisable(GL_LINE_SMOOTH); - glPopMatrix(); -#else if ((m_triggerLevelDis1 > negLimit) && (m_triggerLevelDis1 < posLimit)) { GLfloat q3[] { @@ -623,47 +456,11 @@ void GLScope::paintGL() // glTranslatef(m_glScopeRect1.x(), m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0, 0); // glScalef(m_glScopeRect1.width(), -(m_glScopeRect1.height() / 2) * m_amp1, 1); } -#endif } // paint trace #1 if(m_displayTrace->size() > 0) { -#ifdef GL_DEPRECATED - glBegin(GL_LINE_STRIP); - - for(int i = start; i < end; i++) - { - float v = (*m_displayTrace)[i].real(); - if(v > posLimit) - v = posLimit; - else if(v < negLimit) - v = negLimit; - glVertex2f(i - start, v); - - if ((m_mode == ModeMagdBPha) || (m_mode == ModeMagdBDPha)) - { - if (i == start) - { - m_maxPow = m_powTrace[i]; - m_sumPow = m_powTrace[i]; - } - else - { - if (m_powTrace[i] > m_maxPow) - { - m_maxPow = m_powTrace[i]; - } - - m_sumPow += m_powTrace[i]; - } - } - } - - m_nbPow = end - start; - - glEnd(); -#else { int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size(); int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size()); @@ -721,7 +518,6 @@ void GLScope::paintGL() // glScalef(m_glScopeRect1.width() * (float)m_timeBase / (float)(m_displayTrace->size() - 1), -(m_glScopeRect1.height() / 2) * m_amp1, 1); m_nbPow = end - start; } -#endif } // Paint powers overlays @@ -739,21 +535,6 @@ void GLScope::paintGL() // Paint trace 2 (Q) over if (m_displayTrace->size() > 0) { -#ifdef GL_DEPRECATED - glBegin(GL_LINE_STRIP); - - for(int i = start; i < end; i++) - { - float v = (*m_displayTrace)[i].imag(); - if(v > posLimit) - v = posLimit; - else if(v < negLimit) - v = negLimit; - glVertex2f(i - start, v); - } - - glEnd(); -#else { int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size(); int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size()); @@ -794,7 +575,6 @@ void GLScope::paintGL() // glTranslatef(m_glScopeRect1.x(), m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0, 0); // glScalef(m_glScopeRect1.width() * (float)m_timeBase / (float)(m_displayTrace->size() - 1), -(m_glScopeRect1.height() / 2) * m_amp2, 1); } -#endif } // Paint secondary grid @@ -803,20 +583,6 @@ void GLScope::paintGL() const ScaleEngine::Tick* tick; // Horizontal Y2 tickList = &m_y2Scale.getTickList(); -#ifdef GL_DEPRECATED - for(int i= 0; i < tickList->count(); i++) { - tick = &(*tickList)[i]; - if(tick->major) { - if(tick->textSize > 0) { - float y = 1 - (tick->pos / m_y2Scale.getSize()); - glBegin(GL_LINE_LOOP); - glVertex2f(0, y); - glVertex2f(1, y); - glEnd(); - } - } - } -#else { GLfloat q3[4*tickList->count()]; int effectiveTicks = 0; @@ -837,20 +603,8 @@ void GLScope::paintGL() QVector4D color(0.25f, 1.0f, 1.0f, (float) m_displayGridIntensity / 100.0f); m_glShaderSimple.drawSegments(m_glScopeMatrix1, color, q3, 2*effectiveTicks); } -#endif + // Paint secondary scale -#ifdef GL_DEPRECATED - glBegin(GL_QUADS); - glTexCoord2f(0, 1); - glVertex2f(0, 1); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(1, 0); - glVertex2f(1, 0); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glEnd(); -#else { GLfloat vtx1[] = { 0, 1, @@ -867,7 +621,6 @@ void GLScope::paintGL() m_glShaderLeft2Scale.drawSurface(m_glRight1ScaleMatrix, tex1, vtx1, 4); } -#endif } } // Both displays or primary only @@ -876,14 +629,6 @@ void GLScope::paintGL() if ((m_displays == DisplayBoth) || (m_displays == DisplaySecondOnly)) { // draw rect around -#ifdef GL_DEPRECATED - glBegin(GL_LINE_LOOP); - glVertex2f(1, 1); - glVertex2f(0, 1); - glVertex2f(0, 0); - glVertex2f(1, 0); - glEnd(); -#else { GLfloat q3[] { 1, 1, @@ -895,7 +640,6 @@ void GLScope::paintGL() QVector4D color(1.0f, 1.0f, 1.0f, 0.5f); m_glShaderSimple.drawContour(m_glScopeMatrix2, color, q3, 4); } -#endif // paint grid const ScaleEngine::TickList* tickList; @@ -903,20 +647,6 @@ void GLScope::paintGL() // Horizontal Y2 tickList = &m_y2Scale.getTickList(); -#ifdef GL_DEPRECATED - for(int i= 0; i < tickList->count(); i++) { - tick = &(*tickList)[i]; - if(tick->major) { - if(tick->textSize > 0) { - float y = 1 - (tick->pos / m_y2Scale.getSize()); - glBegin(GL_LINE_LOOP); - glVertex2f(0, y); - glVertex2f(1, y); - glEnd(); - } - } - } -#else { GLfloat q3[4*tickList->count()]; int effectiveTicks = 0; @@ -937,24 +667,9 @@ void GLScope::paintGL() QVector4D color(1.0f, 1.0f, 1.0f, (float) m_displayGridIntensity / 100.0f); m_glShaderSimple.drawSegments(m_glScopeMatrix2, color, q3, 2*effectiveTicks); } -#endif // Vertical X2 tickList = &m_x2Scale.getTickList(); -#ifdef GL_DEPRECATED - for(int i= 0; i < tickList->count(); i++) { - tick = &(*tickList)[i]; - if(tick->major) { - if(tick->textSize > 0) { - float x = tick->pos / m_x2Scale.getSize(); - glBegin(GL_LINE_LOOP); - glVertex2f(x, 0); - glVertex2f(x, 1); - glEnd(); - } - } - } -#else { GLfloat q3[4*tickList->count()]; int effectiveTicks = 0; @@ -975,21 +690,8 @@ void GLScope::paintGL() QVector4D color(1.0f, 1.0f, 1.0f, (float) m_displayGridIntensity / 100.0f); m_glShaderSimple.drawSegments(m_glScopeMatrix2, color, q3, 2*effectiveTicks); } -#endif // paint left #2 scale -#ifdef GL_DEPRECATED - glBegin(GL_QUADS); - glTexCoord2f(0, 1); - glVertex2f(0, 1); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(1, 0); - glVertex2f(1, 0); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glEnd(); -#else { GLfloat vtx1[] = { 0, 1, @@ -1006,21 +708,8 @@ void GLScope::paintGL() m_glShaderLeft2Scale.drawSurface(m_glLeft2ScaleMatrix, tex1, vtx1, 4); } -#endif // paint bottom #2 scale -#ifdef GL_DEPRECATED - glBegin(GL_QUADS); - glTexCoord2f(0, 1); - glVertex2f(0, 1); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(1, 0); - glVertex2f(1, 0); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glEnd(); -#else { GLfloat vtx1[] = { 0, 1, @@ -1037,27 +726,12 @@ void GLScope::paintGL() m_glShaderBottom2Scale.drawSurface(m_glBot2ScaleMatrix, tex1, vtx1, 4); } -#endif // paint trigger level #2 if ((m_triggerChannel == ScopeVis::TriggerPhase) || (m_triggerChannel == ScopeVis::TriggerDPhase) || (m_triggerChannel == ScopeVis::TriggerChannelQ)) { -#ifdef GL_DEPRECATED - glBegin(GL_LINE_LOOP); - if ((m_triggerChannel == ScopeVis::TriggerChannelQ) - || (m_triggerChannel == ScopeVis::TriggerPhase) - || (m_triggerChannel == ScopeVis::TriggerDPhase)) - { - if ((m_triggerLevelDis2 > negLimit) && (m_triggerLevelDis2 < posLimit)) - { - glVertex2f(0, m_triggerLevelDis2); - glVertex2f(1, m_triggerLevelDis2); - } - } - glEnd(); -#else float posLimit = 1.0 / m_amp2; float negLimit = -1.0 / m_amp2; @@ -1080,7 +754,6 @@ void GLScope::paintGL() mat.scale(2.0f * rectW, -2.0f * rectH); m_glShaderSimple.drawSegments(mat, color, q3, 2); } -#endif } // paint trace #2 @@ -1094,27 +767,6 @@ void GLScope::paintGL() if (end - start < 2) { start--; } - -#ifdef GL_DEPRECATED - glBegin(GL_LINE_STRIP); - - for(int i = start; i < end; i++) - { - float x = (*m_displayTrace)[i].real() * m_amp1; - float y = (*m_displayTrace)[i].imag() * m_amp2; - if(x > 1.0f) - x = 1.0f; - else if(x < -1.0f) - x = -1.0f; - if(y > 1.0f) - y = 1.0f; - else if(y < -1.0f) - y = -1.0f; - glVertex2f(x, y); - } - - glEnd(); -#else { GLfloat q3[2*(end - start)]; @@ -1150,22 +802,9 @@ void GLScope::paintGL() // glTranslatef(m_glScopeRect2.x() + m_glScopeRect2.width() / 2.0, m_glScopeRect2.y() + m_glScopeRect2.height() / 2.0, 0); // glScalef(m_glScopeRect2.width() / 2, -(m_glScopeRect2.height() / 2), 1); } -#endif } else { -#ifdef GL_DEPRECATED - glBegin(GL_LINE_STRIP); - for(int i = start; i < end; i++) { - float v = (*m_displayTrace)[i].imag(); - if(v > posLimit) - v = posLimit; - else if(v < negLimit) - v = negLimit; - glVertex2f(i - start, v); - } - glEnd(); -#else { int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size(); int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size()); @@ -1206,7 +845,6 @@ void GLScope::paintGL() // glTranslatef(m_glScopeRect2.x(), m_glScopeRect2.y() + m_glScopeRect2.height() / 2.0, 0); // glScalef(m_glScopeRect2.width() * (float)m_timeBase / (float)(m_displayTrace->size() - 1), -(m_glScopeRect2.height() / 2) * m_amp2, 1); } -#endif } } } // Both displays or secondary display only @@ -1447,30 +1085,8 @@ void GLScope::drawPowerOverlay() painter.drawText(QPointF(0, rect.height() - 2.0f), text); painter.end(); -#ifdef GL_DEPRECATED - if (m_powerOverlayTextureAllocated1) - deleteTexture(m_powerOverlayTexture1); - m_powerOverlayTexture1 = bindTexture(m_powerOverlayPixmap1, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_powerOverlayTextureAllocated1 = true; -#endif m_glShaderPowerOverlay.initTexture(m_powerOverlayPixmap1.toImage()); -#ifdef GL_DEPRECATED - glBegin(GL_QUADS); - glTexCoord2f(0, 1); - glVertex2f(0, 1); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(1, 0); - glVertex2f(1, 0); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glEnd(); -#else { GLfloat vtx1[] = { 0, 1, @@ -1501,7 +1117,6 @@ void GLScope::drawPowerOverlay() // glTranslatef(m_glScopeRect1.x() + shiftX, m_glScopeRect1.y(), 0); // glScalef(rect.width() / (float) width(), rect.height() / (float) height(), 1); } -#endif } void GLScope::applyConfig() @@ -1630,14 +1245,7 @@ void GLScope::applyConfig() (float) 2*(width() - 2*leftMargin - rightMargin) / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot1ScaleRect = QRectF( - (float) leftMargin / (float) width(), - (float) (scopeHeight + topMargin + 1) / (float) height(), - (float) (width() - 2*leftMargin - rightMargin) / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot1ScaleMatrix.setToIdentity(); m_glBot1ScaleMatrix.translate ( -1.0f + ((float) 2*leftMargin / (float) width()), @@ -1647,14 +1255,7 @@ void GLScope::applyConfig() (float) 2*(width() - 2*leftMargin - rightMargin) / (float) width(), (float) -2*(botMargin - 1) / (float) height() ); -#ifdef GL_DEPRECATED - m_glRight1ScaleRect = QRectF( - (float) (width() - leftMargin) / (float) width(), - (float) topMargin / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeHeight / (float) height() - ); -#endif + m_glRight1ScaleMatrix.setToIdentity(); m_glRight1ScaleMatrix.translate ( -1.0f + ((float)(2*(width() - leftMargin)) / (float) width()), @@ -1682,14 +1283,7 @@ void GLScope::applyConfig() (float) 2*scopeWidth / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot1ScaleRect = QRectF( - (float) leftMargin / (float) width(), - (float) (scopeHeight + topMargin + 1) / (float) height(), - (float) scopeWidth / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot1ScaleMatrix.setToIdentity(); m_glBot1ScaleMatrix.translate ( -1.0f + ((float) 2*leftMargin / (float) width()), @@ -1700,14 +1294,7 @@ void GLScope::applyConfig() (float) -2*(botMargin - 1) / (float) height() ); } -#ifdef GL_DEPRECATED - m_glLeft1ScaleRect = QRectF( - 0, - (float) topMargin / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeHeight / (float) height() - ); -#endif + m_glLeft1ScaleMatrix.setToIdentity(); m_glLeft1ScaleMatrix.translate ( -1.0f, @@ -1743,16 +1330,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_left1ScaleTextureAllocated) - deleteTexture(m_left1ScaleTexture); - m_left1ScaleTexture = bindTexture(m_left1ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_left1ScaleTextureAllocated = true; -#endif + m_glShaderLeft1Scale.initTexture(m_left1ScalePixmap.toImage()); } // Y1 scale @@ -1781,16 +1359,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_bot1ScaleTextureAllocated) - deleteTexture(m_bot1ScaleTexture); - m_bot1ScaleTexture = bindTexture(m_bot1ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_bot1ScaleTextureAllocated = true; -#endif + m_glShaderBottom1Scale.initTexture(m_bot1ScalePixmap.toImage()); } // X1 scale @@ -1814,14 +1383,7 @@ void GLScope::applyConfig() (float) 2*scopeDim / (float) width(), (float) -2*scopeDim / (float) height() ); -#ifdef GL_DEPRECATED - m_glLeft2ScaleRect = QRectF( - 0, - (float) (topMargin + scopeDim + botMargin) / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeDim / (float) height() - ); -#endif + m_glLeft2ScaleMatrix.setToIdentity(); m_glLeft2ScaleMatrix.translate ( -1.0f, @@ -1831,14 +1393,7 @@ void GLScope::applyConfig() (float) 2*(leftMargin-1) / (float) width(), (float) -2*scopeDim / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot2ScaleRect = QRectF( - (float) leftMargin / (float) width(), - (float) (scopeDim + topMargin + scopeDim + botMargin + 1) / (float) height(), - (float) scopeDim / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot2ScaleMatrix.setToIdentity(); m_glBot2ScaleMatrix.translate ( -1.0f + ((float) 2*leftMargin / (float) width()), @@ -1866,14 +1421,7 @@ void GLScope::applyConfig() (float) 2*scopeWidth / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glLeft2ScaleRect = QRectF( - 0, - (float) (topMargin + scopeHeight + botMargin) / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeHeight / (float) height() - ); -#endif + m_glLeft2ScaleMatrix.setToIdentity(); m_glLeft2ScaleMatrix.translate ( -1.0f, @@ -1883,14 +1431,7 @@ void GLScope::applyConfig() (float) 2*(leftMargin-1) / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot2ScaleRect = QRectF( - (float) leftMargin / (float) width(), - (float) (scopeHeight + topMargin + scopeHeight + botMargin + 1) / (float) height(), - (float) scopeWidth / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot2ScaleMatrix.setToIdentity(); m_glBot2ScaleMatrix.translate ( -1.0f + ((float) 2*leftMargin / (float) width()), @@ -1926,16 +1467,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_left2ScaleTextureAllocated) - deleteTexture(m_left2ScaleTexture); - m_left2ScaleTexture = bindTexture(m_left2ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_left2ScaleTextureAllocated = true; -#endif + m_glShaderLeft2Scale.initTexture(m_left2ScalePixmap.toImage()); } // Y2 scale @@ -1976,16 +1508,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_bot2ScaleTextureAllocated) - deleteTexture(m_bot2ScaleTexture); - m_bot2ScaleTexture = bindTexture(m_bot2ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_bot2ScaleTextureAllocated = true; -#endif + m_glShaderBottom2Scale.initTexture(m_bot2ScalePixmap.toImage()); } // X2 scale @@ -2012,14 +1535,7 @@ void GLScope::applyConfig() (float) 2*(scopeWidth-leftMargin) / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot1ScaleRect = QRectF( - (float) leftMargin / (float) width(), - (float) (scopeHeight + topMargin + 1) / (float) height(), - (float) (scopeWidth-leftMargin) / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot1ScaleMatrix.setToIdentity(); m_glBot1ScaleMatrix.translate ( -1.0f + ((float) 2*leftMargin / (float) width()), @@ -2029,14 +1545,7 @@ void GLScope::applyConfig() (float) 2*(scopeWidth-leftMargin) / (float) width(), (float) -2*(botMargin - 1) / (float) height() ); -#ifdef GL_DEPRECATED - m_glRight1ScaleRect = QRectF( - (float) (scopeWidth) / (float) width(), - (float) topMargin / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeHeight / (float) height() - ); -#endif + m_glRight1ScaleMatrix.setToIdentity(); m_glRight1ScaleMatrix.translate ( -1.0f + ((float) 2*scopeWidth / (float) width()), @@ -2064,14 +1573,7 @@ void GLScope::applyConfig() (float) 2*scopeWidth / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot1ScaleRect = QRectF( - (float) leftMargin / (float) width(), - (float) (scopeHeight + topMargin + 1) / (float) height(), - (float) scopeWidth / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot1ScaleMatrix.setToIdentity(); m_glBot1ScaleMatrix.translate ( -1.0f + ((float) 2*leftMargin / (float) width()), @@ -2082,14 +1584,7 @@ void GLScope::applyConfig() (float) -2*(botMargin - 1) / (float) height() ); } -#ifdef GL_DEPRECATED - m_glLeft1ScaleRect = QRectF( - 0, - (float) topMargin / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeHeight / (float) height() - ); -#endif + m_glLeft1ScaleMatrix.setToIdentity(); m_glLeft1ScaleMatrix.translate ( -1.0f, @@ -2125,16 +1620,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_left1ScaleTextureAllocated) - deleteTexture(m_left1ScaleTextureAllocated); - m_left1ScaleTexture = bindTexture(m_left1ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_left1ScaleTextureAllocated = true; -#endif + m_glShaderLeft1Scale.initTexture(m_left1ScalePixmap.toImage()); } // Y1 scale @@ -2163,16 +1649,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_bot1ScaleTextureAllocated) - deleteTexture(m_bot1ScaleTexture); - m_bot1ScaleTexture = bindTexture(m_bot1ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_bot1ScaleTextureAllocated = true; -#endif + m_glShaderBottom1Scale.initTexture(m_bot1ScalePixmap.toImage()); } // X1 scale @@ -2196,14 +1673,7 @@ void GLScope::applyConfig() (float) 2*scopeDim / (float) width(), (float) -2*(height() - topMargin - botMargin) / (float) height() ); -#ifdef GL_DEPRECATED - m_glLeft2ScaleRect = QRectF( - (float) (leftMargin + scopeWidth) / (float) width(), - (float) topMargin / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeHeight / (float) height() - ); -#endif + m_glLeft2ScaleMatrix.setToIdentity(); m_glLeft2ScaleMatrix.translate ( -1.0f + (float) 2*(leftMargin + scopeWidth) / (float) width(), @@ -2213,14 +1683,7 @@ void GLScope::applyConfig() (float) 2*(leftMargin-1) / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot2ScaleRect = QRectF( - (float) (leftMargin + leftMargin + scopeWidth) / (float) width(), - (float) (scopeHeight + topMargin + 1) / (float) height(), - (float) scopeDim / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot2ScaleMatrix.setToIdentity(); m_glBot2ScaleMatrix.translate ( -1.0f + ((float) 2*(leftMargin + leftMargin + scopeWidth) / (float) width()), @@ -2248,14 +1711,7 @@ void GLScope::applyConfig() (float) 2*((width() - leftMargin - leftMargin - rightMargin) / 2) / (float) width(), (float) -2*(height() - topMargin - botMargin) / (float) height() ); -#ifdef GL_DEPRECATED - m_glLeft2ScaleRect = QRectF( - (float) (leftMargin + scopeWidth) / (float) width(), - (float) topMargin / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeHeight / (float) height() - ); -#endif + m_glLeft2ScaleMatrix.setToIdentity(); m_glLeft2ScaleMatrix.translate ( -1.0f + (float) 2*(leftMargin + scopeWidth) / (float) width(), @@ -2265,14 +1721,7 @@ void GLScope::applyConfig() (float) 2*(leftMargin-1) / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot2ScaleRect = QRectF( - (float) (leftMargin + leftMargin + scopeWidth) / (float) width(), - (float) (scopeHeight + topMargin + 1) / (float) height(), - (float) scopeWidth / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot2ScaleMatrix.setToIdentity(); m_glBot2ScaleMatrix.translate ( -1.0f + ((float) 2*(leftMargin + leftMargin + scopeWidth) / (float) width()), @@ -2308,16 +1757,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_left2ScaleTextureAllocated) - deleteTexture(m_left2ScaleTexture); - m_left2ScaleTexture = bindTexture(m_left2ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_left2ScaleTextureAllocated = true; -#endif + m_glShaderLeft2Scale.initTexture(m_left2ScalePixmap.toImage()); } // Y2 scale @@ -2358,16 +1798,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_bot2ScaleTextureAllocated) - deleteTexture(m_bot2ScaleTexture); - m_bot2ScaleTexture = bindTexture(m_bot2ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_bot2ScaleTextureAllocated = true; -#endif + m_glShaderBottom2Scale.initTexture(m_bot2ScalePixmap.toImage()); } // X2 scale @@ -2395,14 +1826,7 @@ void GLScope::applyConfig() (float) 2*(scopeWidth-leftMargin) / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot1ScaleRect = QRectF( - (float) leftMargin / (float) width(), - (float) (scopeHeight + topMargin + 1) / (float) height(), - (float) (scopeWidth-leftMargin) / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot1ScaleMatrix.setToIdentity(); m_glBot1ScaleMatrix.translate ( -1.0f + ((float) 2*leftMargin / (float) width()), @@ -2412,14 +1836,7 @@ void GLScope::applyConfig() (float) 2*(scopeWidth-leftMargin) / (float) width(), (float) -2*(botMargin - 1) / (float) height() ); -#ifdef GL_DEPRECATED - m_glRight1ScaleRect = QRectF( - (float) (width() - leftMargin) / (float) width(), - (float) topMargin / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeHeight / (float) height() - ); -#endif + m_glRight1ScaleMatrix.setToIdentity(); m_glRight1ScaleMatrix.translate ( -1.0f + ((float) (2*width() - leftMargin) / (float) width()), @@ -2447,14 +1864,7 @@ void GLScope::applyConfig() (float) 2*scopeWidth / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot1ScaleRect = QRectF( - (float) leftMargin / (float) width(), - (float) (scopeHeight + topMargin + 1) / (float) height(), - (float) scopeWidth / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot1ScaleMatrix.setToIdentity(); m_glBot1ScaleMatrix.translate ( -1.0f + ((float) 2*leftMargin / (float) width()), @@ -2465,14 +1875,7 @@ void GLScope::applyConfig() (float) -2*(botMargin - 1) / (float) height() ); } -#ifdef GL_DEPRECATED - m_glLeft1ScaleRect = QRectF( - 0, - (float) topMargin / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeHeight / (float) height() - ); -#endif + m_glLeft1ScaleMatrix.setToIdentity(); m_glLeft1ScaleMatrix.translate ( -1.0f, @@ -2512,16 +1915,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_left1ScaleTextureAllocated) - deleteTexture(m_left1ScaleTextureAllocated); - m_left1ScaleTexture = bindTexture(m_left1ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_left1ScaleTextureAllocated = true; -#endif + m_glShaderLeft1Scale.initTexture(m_left1ScalePixmap.toImage()); } // Y1 scale @@ -2550,16 +1944,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_left2ScaleTextureAllocated) - deleteTexture(m_left2ScaleTextureAllocated); - m_left2ScaleTexture = bindTexture(m_left2ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_left2ScaleTextureAllocated = true; -#endif + m_glShaderLeft2Scale.initTexture(m_left2ScalePixmap.toImage()); } // Y2 scale @@ -2588,16 +1973,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_bot1ScaleTextureAllocated) - deleteTexture(m_bot1ScaleTexture); - m_bot1ScaleTexture = bindTexture(m_bot1ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_bot1ScaleTextureAllocated = true; -#endif + m_glShaderBottom1Scale.initTexture(m_bot1ScalePixmap.toImage()); } // X1 scale @@ -2626,14 +2002,7 @@ void GLScope::applyConfig() (float) 2*scopeDim / (float) width(), (float) -2*scopeDim / (float) height() ); -#ifdef GL_DEPRECATED - m_glLeft2ScaleRect = QRectF( - 0, - (float) topMargin / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeDim / (float) height() - ); -#endif + m_glLeft2ScaleMatrix.setToIdentity(); m_glLeft2ScaleMatrix.translate ( -1.0f, @@ -2643,14 +2012,7 @@ void GLScope::applyConfig() (float) 2*(leftMargin-1) / (float) width(), (float) -2*scopeDim / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot2ScaleRect = QRectF( - (float) leftMargin / (float) width(), - (float) (scopeDim + topMargin + 1) / (float) height(), - (float) scopeDim / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot2ScaleMatrix.setToIdentity(); m_glBot2ScaleMatrix.translate ( -1.0f + ((float) 2*leftMargin / (float) width()), @@ -2678,14 +2040,7 @@ void GLScope::applyConfig() (float) 2*scopeWidth / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glLeft2ScaleRect = QRectF( - 0, - (float) topMargin / (float) height(), - (float) (leftMargin-1) / (float) width(), - (float) scopeHeight / (float) height() - ); -#endif + m_glLeft2ScaleMatrix.setToIdentity(); m_glLeft2ScaleMatrix.translate ( -1.0f, @@ -2695,14 +2050,7 @@ void GLScope::applyConfig() (float) 2*(leftMargin-1) / (float) width(), (float) -2*scopeHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glBot2ScaleRect = QRectF( - (float) leftMargin / (float) width(), - (float) (scopeHeight + topMargin + 1) / (float) height(), - (float) scopeWidth / (float) width(), - (float) (botMargin - 1) / (float) height() - ); -#endif + m_glBot2ScaleMatrix.setToIdentity(); m_glBot2ScaleMatrix.translate ( -1.0f + ((float) 2*leftMargin / (float) width()), @@ -2739,16 +2087,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_left2ScaleTextureAllocated) - deleteTexture(m_left2ScaleTextureAllocated); - m_left2ScaleTexture = bindTexture(m_left2ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_left2ScaleTextureAllocated = true; -#endif + m_glShaderLeft2Scale.initTexture(m_left2ScalePixmap.toImage()); } // Y2 scale @@ -2789,16 +2128,7 @@ void GLScope::applyConfig() } } } -#ifdef GL_DEPRECATED - if (m_bot2ScaleTextureAllocated) - deleteTexture(m_bot2ScaleTexture); - m_bot2ScaleTexture = bindTexture(m_bot2ScalePixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_bot2ScaleTextureAllocated = true; -#endif + m_glShaderBottom2Scale.initTexture(m_bot2ScalePixmap.toImage()); } // X2 scale diff --git a/sdrbase/gui/glspectrum.cpp b/sdrbase/gui/glspectrum.cpp index 711eb4ebd..e3bdd78d4 100644 --- a/sdrbase/gui/glspectrum.cpp +++ b/sdrbase/gui/glspectrum.cpp @@ -45,12 +45,6 @@ GLSpectrum::GLSpectrum(QWidget* parent) : m_displayMaxHold(false), m_currentSpectrum(0), m_displayCurrent(false), -#ifdef GL_DEPRECATED - m_leftMarginTextureAllocated(false), - m_frequencyTextureAllocated(false), - m_waterfallTextureAllocated(false), - m_histogramTextureAllocated(false), -#endif m_waterfallBuffer(NULL), m_waterfallTextureHeight(-1), m_displayWaterfall(true), @@ -127,13 +121,6 @@ GLSpectrum::~GLSpectrum() delete m_waterfallBuffer; m_waterfallBuffer = NULL; } -#ifdef GL_DEPRECATED - if(m_waterfallTextureAllocated) { - makeCurrent(); - deleteTexture(m_waterfallTexture); - m_waterfallTextureAllocated = false; - } -#endif if(m_histogramBuffer != NULL) { delete m_histogramBuffer; m_histogramBuffer = NULL; @@ -146,21 +133,6 @@ GLSpectrum::~GLSpectrum() delete[] m_histogramHoldoff; m_histogramHoldoff = NULL; } -#ifdef GL_DEPRECATED - if(m_histogramTextureAllocated) { - makeCurrent(); - deleteTexture(m_histogramTexture); - m_histogramTextureAllocated = false; - } - if(m_leftMarginTextureAllocated) { - deleteTexture(m_leftMarginTexture); - m_leftMarginTextureAllocated = false; - } - if(m_frequencyTextureAllocated) { - deleteTexture(m_frequencyTexture); - m_frequencyTextureAllocated = false; - } -#endif } void GLSpectrum::setCenterFrequency(quint64 frequency) @@ -553,11 +525,6 @@ void GLSpectrum::paintGL() return; } -#ifdef GL_DEPRECATED - glPushMatrix(); - glScalef(2.0, -2.0, 1.0); - glTranslatef(-0.50, -0.5, 0); -#endif QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions(); glFunctions->glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glFunctions->glClear(GL_COLOR_BUFFER_BIT); @@ -565,43 +532,6 @@ void GLSpectrum::paintGL() // paint waterfall if (m_displayWaterfall) { -#ifdef GL_DEPRECATED - glBindTexture(GL_TEXTURE_2D, m_waterfallTexture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - - for(int i = 0; i < m_waterfallBufferPos; i++) { - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, m_waterfallTexturePos, m_fftSize, 1, GL_RGBA, GL_UNSIGNED_BYTE, m_waterfallBuffer->scanLine(i)); - m_waterfallTexturePos = (m_waterfallTexturePos + 1) % m_waterfallTextureHeight; - } - - m_waterfallBufferPos = 0; - - float prop_y = m_waterfallTexturePos / (m_waterfallTextureHeight - 1.0); - float off = 1.0 / (m_waterfallTextureHeight - 1.0); - - glPushMatrix(); - glTranslatef(m_glWaterfallRect.x(), m_glWaterfallRect.y(), 0); - glScalef(m_glWaterfallRect.width(), m_glWaterfallRect.height(), 1); - - glEnable(GL_TEXTURE_2D); - - glBegin(GL_QUADS); - glTexCoord2f(0, prop_y + 1 - off); - glVertex2f(0, m_invertedWaterfall ? 0 : 1); - glTexCoord2f(1, prop_y + 1 - off); - glVertex2f(1, m_invertedWaterfall ? 0 : 1); - glTexCoord2f(1, prop_y); - glVertex2f(1, m_invertedWaterfall ? 1 : 0); - glTexCoord2f(0, prop_y); - glVertex2f(0, m_invertedWaterfall ? 1 : 0); - glEnd(); - - glDisable(GL_TEXTURE_2D); - glPopMatrix(); -#else { GLfloat vtx1[] = { 0, m_invertedWaterfall ? 0.0f : 1.0f, @@ -639,7 +569,6 @@ void GLSpectrum::paintGL() m_glShaderWaterfall.drawSurface(m_glWaterfallBoxMatrix, tex1, vtx1, 4); } -#endif // paint channels if (m_mouseInside) @@ -649,29 +578,6 @@ void GLSpectrum::paintGL() ChannelMarkerState* dv = m_channelMarkerStates[i]; if (dv->m_channelMarker->getVisible()) { -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glWaterfallRect.x(), m_glWaterfallRect.y(), 0); - glScalef(m_glWaterfallRect.width(), m_glWaterfallRect.height(), 1); - - glPushMatrix(); - glTranslatef(dv->m_glRect.x(), dv->m_glRect.y(), 0); - glScalef(dv->m_glRect.width(), dv->m_glRect.height(), 1); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(dv->m_channelMarker->getColor().redF(), dv->m_channelMarker->getColor().greenF(), dv->m_channelMarker->getColor().blueF(), 0.3f); - - glBegin(GL_QUADS); - glVertex2f(0, 0); - glVertex2f(1, 0); - glVertex2f(1, 1); - glVertex2f(0, 1); - glEnd(); - - glDisable(GL_BLEND); - glPopMatrix(); - glPopMatrix(); -#else { GLfloat q3[] { 0, 0, @@ -689,31 +595,11 @@ void GLSpectrum::paintGL() m_glShaderSimple.drawSegments(dv->m_glMatrixDsbWaterfall, colorLine, &q3[8], 2); } -#endif } } } // draw rect around -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glWaterfallRect.x(), m_glWaterfallRect.y(), 0); - glScalef(m_glWaterfallRect.width(), m_glWaterfallRect.height(), 1); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glLineWidth(1.0f); - glColor4f(1, 1, 1, 0.5); - - glBegin(GL_LINE_LOOP); - glVertex2f(1, 1); - glVertex2f(0, 1); - glVertex2f(0, 0); - glVertex2f(1, 0); - glEnd(); - glDisable(GL_BLEND); - glPopMatrix(); -#else { GLfloat q3[] { 1, 1, @@ -725,7 +611,6 @@ void GLSpectrum::paintGL() QVector4D color(1.0f, 1.0f, 1.0f, 0.5f); m_glShaderSimple.drawContour(m_glWaterfallBoxMatrix, color, q3, 4); } -#endif } // paint histogram @@ -733,48 +618,6 @@ void GLSpectrum::paintGL() { if(m_displayHistogram) { -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glHistogramRect.x(), m_glHistogramRect.y(), 0); - glScalef(m_glHistogramRect.width(), m_glHistogramRect.height(), 1); - - // import new lines into the texture - quint32* pix; - quint8* bs = m_histogram; - for(int y = 0; y < 100; y++) { - quint8* b = bs; - pix = (quint32*)m_histogramBuffer->scanLine(99 - y); - for(int x = 0; x < m_fftSize; x++) { - *pix = m_histogramPalette[*b]; - pix++; - b += 100; - } - bs++; - } - - // draw texture - glBindTexture(GL_TEXTURE_2D, m_histogramTexture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_fftSize, 100, GL_RGBA, GL_UNSIGNED_BYTE, m_histogramBuffer->scanLine(0)); - glEnable(GL_TEXTURE_2D); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glTexCoord2f(1, 0); - glVertex2f(1, 0); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(0, 1); - glVertex2f(0, 1); - glEnd(); - - glDisable(GL_TEXTURE_2D); - glPopMatrix(); -#else { // import new lines into the texture quint32* pix; @@ -811,7 +654,6 @@ void GLSpectrum::paintGL() m_glShaderHistogram.subTexture(0, 0, m_fftSize, 100, m_histogramBuffer->scanLine(0)); m_glShaderHistogram.drawSurface(m_glHistogramBoxMatrix, tex1, vtx1, 4); } -#endif } @@ -824,25 +666,6 @@ void GLSpectrum::paintGL() ChannelMarkerState* dv = m_channelMarkerStates[i]; if(dv->m_channelMarker->getVisible()) { -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glHistogramRect.x(), m_glHistogramRect.y(), 0); - glScalef(m_glHistogramRect.width(), m_glHistogramRect.height(), 1); - glPushMatrix(); - glTranslatef(dv->m_glRect.x(), dv->m_glRect.y(), 0); - glScalef(dv->m_glRect.width(), dv->m_glRect.height(), 1); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(dv->m_channelMarker->getColor().redF(), dv->m_channelMarker->getColor().greenF(), dv->m_channelMarker->getColor().blueF(), 0.3f); - glBegin(GL_QUADS); - glVertex2f(0, 0); - glVertex2f(1, 0); - glVertex2f(1, 1); - glVertex2f(0, 1); - glEnd(); - glPopMatrix(); - glPopMatrix(); -#else { GLfloat q3[] { 0, 0, @@ -864,29 +687,11 @@ void GLSpectrum::paintGL() m_glShaderSimple.drawSegments(dv->m_glMatrixDsbHistogram, colorLine, &q3[4], 4); } -#endif } } } // draw rect around -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glHistogramRect.x(), m_glHistogramRect.y(), 0); - glScalef(m_glHistogramRect.width(), m_glHistogramRect.height(), 1); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glLineWidth(1.0f); - glColor4f(1, 1, 1, 0.5); - glBegin(GL_LINE_LOOP); - glVertex2f(1, 1); - glVertex2f(0, 1); - glVertex2f(0, 0); - glVertex2f(1, 0); - glEnd(); - glDisable(GL_BLEND); - glPopMatrix(); -#else { GLfloat q3[] { 1, 1, @@ -898,37 +703,11 @@ void GLSpectrum::paintGL() QVector4D color(1.0f, 1.0f, 1.0f, 0.5f); m_glShaderSimple.drawContour(m_glHistogramBoxMatrix, color, q3, 4); } -#endif } // paint left scales (time and power) if (m_displayWaterfall || m_displayMaxHold || m_displayCurrent || m_displayHistogram ) { -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glLeftScaleRect.x(), m_glLeftScaleRect.y(), 0); - glScalef(m_glLeftScaleRect.width(), m_glLeftScaleRect.height(), 1); - - glBindTexture(GL_TEXTURE_2D, m_leftMarginTexture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glEnable(GL_TEXTURE_2D); - glBegin(GL_QUADS); - glTexCoord2f(0, 1); - glVertex2f(0, 1); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(1, 0); - glVertex2f(1, 0); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glEnd(); - glDisable(GL_TEXTURE_2D); - - glPopMatrix(); -#else { GLfloat vtx1[] = { 0, 1, @@ -945,39 +724,11 @@ void GLSpectrum::paintGL() m_glShaderLeftScale.drawSurface(m_glLeftScaleBoxMatrix, tex1, vtx1, 4); } -#endif } // paint frequency scale if (m_displayWaterfall || m_displayMaxHold || m_displayCurrent || m_displayHistogram ) { -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glFrequencyScaleRect.x(), m_glFrequencyScaleRect.y(), 0); - glScalef(m_glFrequencyScaleRect.width(), m_glFrequencyScaleRect.height(), 1); - - glBindTexture(GL_TEXTURE_2D, m_frequencyTexture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_TEXTURE_2D); - glBegin(GL_QUADS); - glTexCoord2f(0, 1); - glVertex2f(0, 1); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(1, 0); - glVertex2f(1, 0); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glEnd(); - glDisable(GL_TEXTURE_2D); - - glPopMatrix(); -#else { GLfloat vtx1[] = { 0, 1, @@ -994,7 +745,6 @@ void GLSpectrum::paintGL() m_glShaderFrequencyScale.drawSurface(m_glFrequencyScaleBoxMatrix, tex1, vtx1, 4); } -#endif // paint channels @@ -1006,26 +756,6 @@ void GLSpectrum::paintGL() // frequency scale channel overlay if(dv->m_channelMarker->getVisible()) { -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glWaterfallRect.x(), m_glFrequencyScaleRect.y(), 0); - glScalef(m_glWaterfallRect.width(), m_glFrequencyScaleRect.height(), 1); - glPushMatrix(); - glTranslatef(dv->m_glRect.x(), dv->m_glRect.y(), 0); - glScalef(dv->m_glRect.width(), dv->m_glRect.height(), 1); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(dv->m_channelMarker->getColor().redF(), dv->m_channelMarker->getColor().greenF(), dv->m_channelMarker->getColor().blueF(), 0.5f); - glBegin(GL_QUADS); - glVertex2f(0, 0); - glVertex2f(1, 0); - glVertex2f(1, 0.5); - glVertex2f(0, 0.5); - glEnd(); - glDisable(GL_BLEND); - glPopMatrix(); - glPopMatrix(); -#else { GLfloat q3[] { 1, 0.2, @@ -1048,7 +778,6 @@ void GLSpectrum::paintGL() m_glShaderSimple.drawSegments(dv->m_glMatrixDsbFreqScale, colorLine, &q3[4], 4); } } -#endif } } } @@ -1071,32 +800,6 @@ void GLSpectrum::paintGL() j = j - 99; m_maxHold[i] = (j * m_powerRange) / 99.0 + m_referenceLevel; } - -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glHistogramRect.x(), m_glHistogramRect.y(), 0); - glScalef(m_glHistogramRect.width() / (float)(m_fftSize - 1), -m_glHistogramRect.height() / m_powerRange, 1); - - Real bottom = -m_powerRange; - glColor4f(1, 0, 0, m_displayTraceIntensity / 100.0); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glLineWidth(1.0f); - - //glEnable(GL_LINE_SMOOTH); - glBegin(GL_LINE_STRIP); - for(int i = 0; i < m_fftSize; i++) { - Real v = m_maxHold[i] - m_referenceLevel; - if(v > 0) - v = 0; - else if(v < bottom) - v = bottom; - glVertex2f(i, v); - } - glEnd(); - //glDisable(GL_LINE_SMOOTH); - glPopMatrix(); -#else { GLfloat q3[2*m_fftSize]; Real bottom = -m_powerRange; @@ -1114,53 +817,11 @@ void GLSpectrum::paintGL() QVector4D color(1.0f, 0.0f, 0.0f, (float) m_displayTraceIntensity / 100.0f); m_glShaderSimple.drawPolyline(m_glHistogramSpectrumMatrix, color, q3, m_fftSize); } -#endif } // paint current spectrum line on top of histogram - if ((m_displayCurrent) && m_currentSpectrum) { -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glHistogramRect.x(), m_glHistogramRect.y(), 0); - glScalef(m_glHistogramRect.width() / (float)(m_fftSize - 1), -m_glHistogramRect.height() / m_powerRange, 1); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glLineWidth(1.0f); - glColor4f(1.0f, 1.0f, 0.25f, m_displayTraceIntensity / 100.0); // intense yellow - Real bottom = -m_powerRange; - - { - GLfloat q3[2*m_fftSize]; - - for(int i = 0; i < m_fftSize; i++) { - Real v = (*m_currentSpectrum)[i] - m_referenceLevel; - if(v > 0) - v = 0; - else if(v < bottom) - v = bottom; - q3[2*i] = (Real) i; - q3[2*i+1] = v; - } - - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(2, GL_FLOAT, 0, q3); - glDrawArrays(GL_LINE_STRIP, 0, m_fftSize); - glDisableClientState(GL_VERTEX_ARRAY); - } - /* - glBegin(GL_LINE_STRIP); - for(int i = 0; i < m_fftSize; i++) { - Real v = (*m_currentSpectrum)[i] - m_referenceLevel; - if(v > 0) - v = 0; - else if(v < bottom) - v = bottom; - glVertex2f(i, v); - } - glEnd();*/ - glPopMatrix(); -#else + if ((m_displayCurrent) && m_currentSpectrum) + { { Real bottom = -m_powerRange; GLfloat q3[2*m_fftSize]; @@ -1178,7 +839,6 @@ void GLSpectrum::paintGL() QVector4D color(1.0f, 1.0f, 0.25f, (float) m_displayTraceIntensity / 100.0f); m_glShaderSimple.drawPolyline(m_glHistogramSpectrumMatrix, color, q3, m_fftSize); } -#endif } // paint waterfall grid @@ -1188,31 +848,6 @@ void GLSpectrum::paintGL() const ScaleEngine::Tick* tick; tickList = &m_timeScale.getTickList(); -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glWaterfallRect.x(), m_glWaterfallRect.y(), 0); - glScalef(m_glWaterfallRect.width(), m_glWaterfallRect.height(), 1); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glLineWidth(1.0f); - glColor4f(1, 1, 1, m_displayGridIntensity / 100.0); - - for(int i= 0; i < tickList->count(); i++) { - tick = &(*tickList)[i]; - if(tick->major) { - if(tick->textSize > 0) { - float y = tick->pos / m_timeScale.getSize(); - glBegin(GL_LINE_LOOP); - glVertex2f(0, y); - glVertex2f(1, y); - glEnd(); - } - } - } - - glPopMatrix(); -#else { GLfloat q3[4*tickList->count()]; int effectiveTicks = 0; @@ -1237,29 +872,9 @@ void GLSpectrum::paintGL() QVector4D color(1.0f, 1.0f, 1.0f, (float) m_displayGridIntensity / 100.0f); m_glShaderSimple.drawSegments(m_glWaterfallBoxMatrix, color, q3, 2*effectiveTicks); } -#endif + tickList = &m_frequencyScale.getTickList(); -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glWaterfallRect.x(), m_glWaterfallRect.y(), 0); - glScalef(m_glWaterfallRect.width(), m_glWaterfallRect.height(), 1); - - for(int i= 0; i < tickList->count(); i++) { - tick = &(*tickList)[i]; - if(tick->major) { - if(tick->textSize > 0) { - float x = tick->pos / m_frequencyScale.getSize(); - glBegin(GL_LINE_LOOP); - glVertex2f(x, 0); - glVertex2f(x, 1); - glEnd(); - } - } - } - - glPopMatrix(); -#else { GLfloat q3[4*tickList->count()]; int effectiveTicks = 0; @@ -1284,7 +899,6 @@ void GLSpectrum::paintGL() QVector4D color(1.0f, 1.0f, 1.0f, (float) m_displayGridIntensity / 100.0f); m_glShaderSimple.drawSegments(m_glWaterfallBoxMatrix, color, q3, 2*effectiveTicks); } -#endif } // paint histogram grid @@ -1294,34 +908,6 @@ void GLSpectrum::paintGL() const ScaleEngine::Tick* tick; tickList = &m_powerScale.getTickList(); -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glHistogramRect.x(), m_glHistogramRect.y(), 0); - glScalef(m_glHistogramRect.width(), m_glHistogramRect.height(), 1); - - for (int i= 0; i < tickList->count(); i++) - { - tick = &(*tickList)[i]; - if(tick->major) - { - if(tick->textSize > 0) - { - float y = tick->pos / m_powerScale.getSize(); - glBegin(GL_LINE_LOOP); - glVertex2f(0, 1-y); - glVertex2f(1, 1-y); - glEnd(); - } - } - } - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glLineWidth(1.0f); - glColor4f(1, 1, 1, m_displayGridIntensity / 100.0); - - glPopMatrix(); -#else { GLfloat q3[4*tickList->count()]; int effectiveTicks = 0; @@ -1346,29 +932,9 @@ void GLSpectrum::paintGL() QVector4D color(1.0f, 1.0f, 1.0f, (float) m_displayGridIntensity / 100.0f); m_glShaderSimple.drawSegments(m_glHistogramBoxMatrix, color, q3, 2*effectiveTicks); } -#endif + tickList = &m_frequencyScale.getTickList(); -#ifdef GL_DEPRECATED - glPushMatrix(); - glTranslatef(m_glHistogramRect.x(), m_glHistogramRect.y(), 0); - glScalef(m_glHistogramRect.width(), m_glHistogramRect.height(), 1); - - for(int i= 0; i < tickList->count(); i++) { - tick = &(*tickList)[i]; - if(tick->major) { - if(tick->textSize > 0) { - float x = tick->pos / m_frequencyScale.getSize(); - glBegin(GL_LINE_LOOP); - glVertex2f(x, 0); - glVertex2f(x, 1); - glEnd(); - } - } - } - - glPopMatrix(); -#else { GLfloat q3[4*tickList->count()]; int effectiveTicks = 0; @@ -1394,11 +960,8 @@ void GLSpectrum::paintGL() QVector4D color(1.0f, 1.0f, 1.0f, (float) m_displayGridIntensity / 100.0f); m_glShaderSimple.drawSegments(m_glHistogramBoxMatrix, color, q3, 2*effectiveTicks); } -#endif } -#ifdef GL_DEPRECATGED - glPopMatrix(); -#endif + m_mutex.unlock(); } @@ -1493,15 +1056,6 @@ void GLSpectrum::applyChanges() m_frequencyScale.setSize(width() - leftMargin - rightMargin); m_frequencyScale.setRange(Unit::Frequency, m_centerFrequency - m_sampleRate / 2, m_centerFrequency + m_sampleRate / 2); -#ifdef GL_DEPRECATED - m_glWaterfallRect = QRectF( - (float)leftMargin / (float)width(), - (float)waterfallTop / (float)height(), - (float)(width() - leftMargin - rightMargin) / (float)width(), - (float)waterfallHeight / (float)height() - ); -#endif - m_glWaterfallBoxMatrix.setToIdentity(); m_glWaterfallBoxMatrix.translate( -1.0f + ((float)(2*leftMargin) / (float) width()), @@ -1511,14 +1065,7 @@ void GLSpectrum::applyChanges() ((float) 2 * (width() - leftMargin - rightMargin)) / (float) width(), (float) (-2*waterfallHeight) / (float) height() ); -#ifdef GL_DEPRACATED - m_glHistogramRect = QRectF( - (float)leftMargin / (float)width(), - (float)histogramTop / (float)height(), - (float)(width() - leftMargin - rightMargin) / (float)width(), - (float)histogramHeight / (float)height() - ); -#endif + m_glHistogramBoxMatrix.setToIdentity(); m_glHistogramBoxMatrix.translate( -1.0f + ((float)(2*leftMargin) / (float) width()), @@ -1545,14 +1092,7 @@ void GLSpectrum::applyChanges() width(), frequencyScaleHeight ); -#ifdef GL_DEPRECATED - m_glFrequencyScaleRect = QRectF( - (float)0, - (float)frequencyScaleTop / (float)height(), - (float)1, - (float)frequencyScaleHeight / (float)height() - ); -#endif + m_glFrequencyScaleBoxMatrix.setToIdentity(); m_glFrequencyScaleBoxMatrix.translate ( -1.0f, @@ -1563,15 +1103,6 @@ void GLSpectrum::applyChanges() (float) -2*frequencyScaleHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glLeftScaleRect = QRectF( - (float)0, - (float)0, - (float)(leftMargin - 1) / (float)width(), - (float)1 - ); -#endif - m_glLeftScaleBoxMatrix.setToIdentity(); m_glLeftScaleBoxMatrix.translate(-1.0f, 1.0f); m_glLeftScaleBoxMatrix.scale( @@ -1620,14 +1151,7 @@ void GLSpectrum::applyChanges() m_frequencyScale.setSize(width() - leftMargin - rightMargin); m_frequencyScale.setRange(Unit::Frequency, m_centerFrequency - m_sampleRate / 2.0, m_centerFrequency + m_sampleRate / 2.0); -#ifdef GL_DEPRECATED - m_glWaterfallRect = QRectF( - (float)leftMargin / (float)width(), - (float)topMargin / (float)height(), - (float)(width() - leftMargin - rightMargin) / (float)width(), - (float)waterfallHeight / (float)height() - ); -#endif + m_glWaterfallBoxMatrix.setToIdentity(); m_glWaterfallBoxMatrix.translate( -1.0f + ((float)(2*leftMargin) / (float) width()), @@ -1644,14 +1168,7 @@ void GLSpectrum::applyChanges() width(), frequencyScaleHeight ); -#ifdef GL_DEPRECATED - m_glFrequencyScaleRect = QRectF( - (float)0, - (float)frequencyScaleTop / (float)height(), - (float)1, - (float)frequencyScaleHeight / (float)height() - ); -#endif + m_glFrequencyScaleBoxMatrix.setToIdentity(); m_glFrequencyScaleBoxMatrix.translate ( -1.0f, @@ -1662,15 +1179,6 @@ void GLSpectrum::applyChanges() (float) -2*frequencyScaleHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glLeftScaleRect = QRectF( - (float)0, - (float)0, - (float)(leftMargin - 1) / (float)width(), - (float)1 - ); -#endif - m_glLeftScaleBoxMatrix.setToIdentity(); m_glLeftScaleBoxMatrix.translate(-1.0f, 1.0f); m_glLeftScaleBoxMatrix.scale( @@ -1694,14 +1202,7 @@ void GLSpectrum::applyChanges() m_frequencyScale.setSize(width() - leftMargin - rightMargin); m_frequencyScale.setRange(Unit::Frequency, m_centerFrequency - m_sampleRate / 2, m_centerFrequency + m_sampleRate / 2); -#ifdef GL_DEPRECATED - m_glHistogramRect = QRectF( - (float)leftMargin / (float)width(), - (float)histogramTop / (float)height(), - (float)(width() - leftMargin - rightMargin) / (float)width(), - (float)(height() - topMargin - frequencyScaleHeight) / (float)height() - ); -#endif + m_glHistogramSpectrumMatrix.setToIdentity(); m_glHistogramSpectrumMatrix.translate( -1.0f + ((float)(2*leftMargin) / (float) width()), @@ -1728,14 +1229,7 @@ void GLSpectrum::applyChanges() width(), frequencyScaleHeight ); -#ifdef GL_DEPRECATED - m_glFrequencyScaleRect = QRectF( - (float)0, - (float)frequencyScaleTop / (float)height(), - (float)1, - (float)frequencyScaleHeight / (float)height() - ); -#endif + m_glFrequencyScaleBoxMatrix.setToIdentity(); m_glFrequencyScaleBoxMatrix.translate ( -1.0f, @@ -1746,14 +1240,6 @@ void GLSpectrum::applyChanges() (float) -2*frequencyScaleHeight / (float) height() ); -#ifdef GL_DEPRECATED - m_glLeftScaleRect = QRectF( - (float)0, - (float)0, - (float)(leftMargin - 1) / (float)width(), - (float)1 - ); -#endif m_glLeftScaleBoxMatrix.setToIdentity(); m_glLeftScaleBoxMatrix.translate(-1.0f, 1.0f); m_glLeftScaleBoxMatrix.scale( @@ -1788,15 +1274,8 @@ void GLSpectrum::applyChanges() nw = -pw; } - // draw the DSB rectangle -#ifdef GL_DEPRECATED - dv->m_glRectDsb.setRect( - m_frequencyScale.getPosFromValue(xc - (dsbw/2)) / (float)(width() - leftMargin - rightMargin), - 0, - dsbw / (float)m_sampleRate, - 1); -#endif + QMatrix4x4 glMatrixDsb; glMatrixDsb.setToIdentity(); glMatrixDsb.translate( @@ -1839,13 +1318,7 @@ void GLSpectrum::applyChanges() ); // draw the effective BW rectangle -#ifdef GL_DEPRECATED - dv->m_glRect.setRect( - m_frequencyScale.getPosFromValue(xc + nw) / (float)(width() - leftMargin - rightMargin), - 0, - (pw-nw) / (float)m_sampleRate, - 1); -#endif + QMatrix4x4 glMatrix; glMatrix.setToIdentity(); glMatrix.translate( @@ -1945,16 +1418,7 @@ void GLSpectrum::applyChanges() } } } -#ifdef GL_DEPRECATED - if(m_leftMarginTextureAllocated) - deleteTexture(m_leftMarginTexture); - m_leftMarginTexture = bindTexture(m_leftMarginPixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_leftMarginTextureAllocated = true; -#endif + m_glShaderLeftScale.initTexture(m_leftMarginPixmap.toImage()); } // prepare frequency scale @@ -2001,30 +1465,10 @@ void GLSpectrum::applyChanges() } } -#ifdef GL_DEPRECATED - if(m_frequencyTextureAllocated) - deleteTexture(m_frequencyTexture); - m_frequencyTexture = bindTexture(m_frequencyPixmap, - GL_TEXTURE_2D, - GL_RGBA, - QGLContext::LinearFilteringBindOption | - QGLContext::MipmapBindOption); - m_frequencyTextureAllocated = true; -#endif + m_glShaderFrequencyScale.initTexture(m_frequencyPixmap.toImage()); } -#ifdef GL_DEPRECATED - if(!m_waterfallTextureAllocated) { - glGenTextures(1, &m_waterfallTexture); - m_waterfallTextureAllocated = true; - } - if(!m_histogramTextureAllocated) { - glGenTextures(1, &m_histogramTexture); - m_histogramTextureAllocated = true; - } -#endif - bool fftSizeChanged = true; if(m_waterfallBuffer != NULL) { @@ -2055,23 +1499,8 @@ void GLSpectrum::applyChanges() } } - if(fftSizeChanged) { -#ifdef GL_DEPRECATED - if(m_waterfallBuffer != NULL) { - delete m_waterfallBuffer; - m_waterfallBuffer = NULL; - } - m_waterfallBuffer = new QImage(m_fftSize, m_waterfallBufferHeight, QImage::Format_ARGB32); - if(m_waterfallBuffer != NULL) { - m_waterfallBuffer->fill(qRgb(0x00, 0x00, 0x00)); - m_glShaderWaterfall.initTexture(*m_waterfallBuffer); - m_waterfallBufferPos = 0; - } else { - m_fftSize = 0; - m_changesPending = true; - return; - } -#endif + if(fftSizeChanged) + { if(m_histogramBuffer != NULL) { delete m_histogramBuffer; m_histogramBuffer = NULL; @@ -2103,25 +1532,11 @@ void GLSpectrum::applyChanges() memset(m_histogram, 0x00, 100 * m_fftSize); m_histogramHoldoff = new quint8[100 * m_fftSize]; memset(m_histogramHoldoff, 0x07, 100 * m_fftSize); - -#ifdef GL_DEPRECATED - quint8* data = new quint8[m_fftSize * 100 * 4]; - memset(data, 0x00, m_fftSize * 100 * 4); - glBindTexture(GL_TEXTURE_2D, m_histogramTexture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_fftSize, 100, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); - delete[] data; -#endif } - if(fftSizeChanged || windowSizeChanged) { + if(fftSizeChanged || windowSizeChanged) + { m_waterfallTextureHeight = waterfallHeight; -#ifdef GL_DEPRECATED - quint8* data = new quint8[m_fftSize * m_waterfallTextureHeight * 4]; - memset(data, 0x00, m_fftSize * m_waterfallTextureHeight * 4); - glBindTexture(GL_TEXTURE_2D, m_waterfallTexture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_fftSize, m_waterfallTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); - delete[] data; -#endif m_waterfallTexturePos = 0; } }