1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 00:18:37 -05:00

OpenGL modernization: draw the max hold spectrum line in the new way

This commit is contained in:
f4exb 2016-03-03 00:19:18 +01:00
parent 691a34cb16
commit 7d0fe882d7

View File

@ -1122,6 +1122,7 @@ void GLSpectrum::paintGL()
m_maxHold[i] = (j * m_powerRange) / 99.0 + m_referenceLevel; m_maxHold[i] = (j * m_powerRange) / 99.0 + m_referenceLevel;
} }
#ifdef GL_DEPRECATED
glPushMatrix(); glPushMatrix();
glTranslatef(m_glHistogramRect.x(), m_glHistogramRect.y(), 0); glTranslatef(m_glHistogramRect.x(), m_glHistogramRect.y(), 0);
glScalef(m_glHistogramRect.width() / (float)(m_fftSize - 1), -m_glHistogramRect.height() / m_powerRange, 1); glScalef(m_glHistogramRect.width() / (float)(m_fftSize - 1), -m_glHistogramRect.height() / m_powerRange, 1);
@ -1132,7 +1133,6 @@ void GLSpectrum::paintGL()
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLineWidth(1.0f); glLineWidth(1.0f);
#ifdef GL_DEPRECATED
//glEnable(GL_LINE_SMOOTH); //glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
for(int i = 0; i < m_fftSize; i++) { for(int i = 0; i < m_fftSize; i++) {
@ -1144,9 +1144,12 @@ void GLSpectrum::paintGL()
glVertex2f(i, v); glVertex2f(i, v);
} }
glEnd(); glEnd();
//glDisable(GL_LINE_SMOOTH);
glPopMatrix();
#else #else
{ {
GLfloat q3[2*m_fftSize]; GLfloat q3[2*m_fftSize];
Real bottom = -m_powerRange;
for(int i = 0; i < m_fftSize; i++) { for(int i = 0; i < m_fftSize; i++) {
Real v = m_maxHold[i] - m_referenceLevel; Real v = m_maxHold[i] - m_referenceLevel;
@ -1157,21 +1160,11 @@ void GLSpectrum::paintGL()
q3[2*i] = (Real) i; q3[2*i] = (Real) i;
q3[2*i+1] = v; q3[2*i+1] = v;
} }
#ifdef GL_ANDROID
glEnableVertexAttribArray(GL_VERTEX_ARRAY); QVector4D color(1.0f, 0.0f, 0.0f, (float) m_displayTraceIntensity / 100.0f);
glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); m_glShaderSimplePolyline.draw(m_glHistogramMatrix, color, q3, m_fftSize);
glDrawArrays(GL_LINE_STRIP, 0, m_fftSize);
glDisableVertexAttribArray(GL_VERTEX_ARRAY);
#else
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, q3);
glDrawArrays(GL_LINE_STRIP, 0, m_fftSize);
glDisableClientState(GL_VERTEX_ARRAY);
#endif
} }
#endif #endif
//glDisable(GL_LINE_SMOOTH);
glPopMatrix();
} }
// paint current spectrum line on top of histogram // paint current spectrum line on top of histogram