mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-23 00:18:37 -05:00
Reorder glPushMatrix and glBindTexture to ease future migration to Open GL ES 2.0
This commit is contained in:
parent
5ecf7ea00c
commit
718dcf3d8f
@ -306,14 +306,14 @@ void GLScope::paintGL()
|
||||
glPopMatrix();
|
||||
|
||||
// paint left #1 scale
|
||||
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);
|
||||
glPushMatrix();
|
||||
glTranslatef(m_glLeft1ScaleRect.x(), m_glLeft1ScaleRect.y(), 0);
|
||||
glScalef(m_glLeft1ScaleRect.width(), m_glLeft1ScaleRect.height(), 1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 1);
|
||||
@ -329,14 +329,14 @@ void GLScope::paintGL()
|
||||
glPopMatrix();
|
||||
|
||||
// paint bottom #1 scale
|
||||
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);
|
||||
glPushMatrix();
|
||||
glTranslatef(m_glBot1ScaleRect.x(), m_glBot1ScaleRect.y(), 0);
|
||||
glScalef(m_glBot1ScaleRect.width(), m_glBot1ScaleRect.height(), 1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 1);
|
||||
@ -515,14 +515,14 @@ void GLScope::paintGL()
|
||||
glPopMatrix();
|
||||
|
||||
// Paint secondary scale
|
||||
glPushMatrix();
|
||||
glTranslatef(m_glRight1ScaleRect.x(), m_glRight1ScaleRect.y(), 0);
|
||||
glScalef(m_glRight1ScaleRect.width(), m_glRight1ScaleRect.height(), 1);
|
||||
glBindTexture(GL_TEXTURE_2D, m_left2ScaleTexture);
|
||||
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);
|
||||
glPushMatrix();
|
||||
glTranslatef(m_glRight1ScaleRect.x(), m_glRight1ScaleRect.y(), 0);
|
||||
glScalef(m_glRight1ScaleRect.width(), m_glRight1ScaleRect.height(), 1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 1);
|
||||
@ -597,14 +597,14 @@ void GLScope::paintGL()
|
||||
glPopMatrix();
|
||||
|
||||
// paint left #2 scale
|
||||
glPushMatrix();
|
||||
glTranslatef(m_glLeft2ScaleRect.x(), m_glLeft2ScaleRect.y(), 0);
|
||||
glScalef(m_glLeft2ScaleRect.width(), m_glLeft2ScaleRect.height(), 1);
|
||||
glBindTexture(GL_TEXTURE_2D, m_left2ScaleTexture);
|
||||
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);
|
||||
glPushMatrix();
|
||||
glTranslatef(m_glLeft2ScaleRect.x(), m_glLeft2ScaleRect.y(), 0);
|
||||
glScalef(m_glLeft2ScaleRect.width(), m_glLeft2ScaleRect.height(), 1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 1);
|
||||
@ -620,14 +620,14 @@ void GLScope::paintGL()
|
||||
glPopMatrix();
|
||||
|
||||
// paint bottom #2 scale
|
||||
glPushMatrix();
|
||||
glTranslatef(m_glBot2ScaleRect.x(), m_glBot2ScaleRect.y(), 0);
|
||||
glScalef(m_glBot2ScaleRect.width(), m_glBot2ScaleRect.height(), 1);
|
||||
glBindTexture(GL_TEXTURE_2D, m_bot2ScaleTexture);
|
||||
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);
|
||||
glPushMatrix();
|
||||
glTranslatef(m_glBot2ScaleRect.x(), m_glBot2ScaleRect.y(), 0);
|
||||
glScalef(m_glBot2ScaleRect.width(), m_glBot2ScaleRect.height(), 1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 1);
|
||||
@ -989,12 +989,6 @@ void GLScope::drawPowerOverlay()
|
||||
QGLContext::MipmapBindOption);
|
||||
m_powerOverlayTextureAllocated1 = true;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_powerOverlayTexture1);
|
||||
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);
|
||||
|
||||
float shiftX = m_glScopeRect1.width() - ((rect.width() + 4.0f) / width());
|
||||
float shiftY = 6.0f / height();
|
||||
|
||||
@ -1003,6 +997,11 @@ void GLScope::drawPowerOverlay()
|
||||
glTranslatef(m_glScopeRect1.x() + shiftX, m_glScopeRect1.y(), 0);
|
||||
glScalef(rect.width() / (float) width(), rect.height() / (float) height(), 1);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_powerOverlayTexture1);
|
||||
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);
|
||||
|
@ -689,16 +689,15 @@ void GLSpectrum::paintGL()
|
||||
|
||||
// paint left scales (time and power)
|
||||
if(m_displayWaterfall || m_displayMaxHold || m_displayCurrent || m_displayHistogram ) {
|
||||
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);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(m_glLeftScaleRect.x(), m_glLeftScaleRect.y(), 0);
|
||||
glScalef(m_glLeftScaleRect.width(), m_glLeftScaleRect.height(), 1);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 1);
|
||||
@ -711,11 +710,16 @@ void GLSpectrum::paintGL()
|
||||
glVertex2f(0, 0);
|
||||
glEnd();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
// paint frequency scale
|
||||
if(m_displayWaterfall || m_displayMaxHold || m_displayCurrent || m_displayHistogram ) {
|
||||
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);
|
||||
@ -723,11 +727,6 @@ void GLSpectrum::paintGL()
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(m_glFrequencyScaleRect.x(), m_glFrequencyScaleRect.y(), 0);
|
||||
glScalef(m_glFrequencyScaleRect.width(), m_glFrequencyScaleRect.height(), 1);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 1);
|
||||
@ -740,6 +739,7 @@ void GLSpectrum::paintGL()
|
||||
glVertex2f(0, 0);
|
||||
glEnd();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
// paint channels
|
||||
|
Loading…
Reference in New Issue
Block a user