From b2dc3026bc2761802227f2bbaa59abca073975aa Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 29 Feb 2016 03:04:14 +0100 Subject: [PATCH] Android OpenGL specifics #1 --- include/util/gleshelp.h | 10 +-- sdrbase/gui/glscope.cpp | 161 ++++++++++++++++++++++++++++++++++--- sdrbase/gui/glspectrum.cpp | 146 ++++++++++++++++++++++++++++++--- 3 files changed, 288 insertions(+), 29 deletions(-) diff --git a/include/util/gleshelp.h b/include/util/gleshelp.h index b027e7715..d1dc9a081 100644 --- a/include/util/gleshelp.h +++ b/include/util/gleshelp.h @@ -19,15 +19,13 @@ #ifndef INCLUDE_UTIL_GLESHELP_H_ #define INCLUDE_UTIL_GLESHELP_H_ -#define GLdouble GLfloat -#define GL_CLAMP GL_CLAMP_TO_EDGE -#define glClearDepth glClearDepthf -#define glOrtho glOrthof -#define glFrustum glFrustumf +#define GL_VERTEX_ARRAY 0 // We like submitting vertices on stream 0 for no special reason (GL: 0x8074) +#define GL_NORMAL_ARRAY 1 // We like submitting normals on stream 1 for no special reason (GL: 0x8075) +#define GL_TEXTURE_COORD_ARRAY 2 // We like submitting texcoords on stream 2 for no special reason (GL: 0x8078) #define glColor4fv(a) glColor4f(a[0], a[1], a[2], a[3]) #define glColor3fv(a) glColor4f(a[0], a[1], a[2], 1.0f) -#define glColor3f(a,b,c) glColor4f(a, b, c, 1.0f +#define glColor3f(a,b,c) glColor4f(a, b, c, 1.0f) #endif /* INCLUDE_UTIL_GLESHELP_H_ */ diff --git a/sdrbase/gui/glscope.cpp b/sdrbase/gui/glscope.cpp index ccd665cf9..52dd157db 100644 --- a/sdrbase/gui/glscope.cpp +++ b/sdrbase/gui/glscope.cpp @@ -6,6 +6,10 @@ #include #include +#ifdef GL_ANDROID +#include "util/gleshelp.h" +#endif + /* #ifdef _WIN32 static double log2f(double n) @@ -270,11 +274,17 @@ void GLScope::paintGL() 0, 0, 1, 0 }; - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINE_LOOP, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINE_LOOP, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glDisable(GL_BLEND); @@ -322,11 +332,17 @@ void GLScope::paintGL() } } } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2*effectiveTicks); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2*effectiveTicks); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif // Vertical X1 @@ -362,11 +378,17 @@ void GLScope::paintGL() } } } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2*effectiveTicks); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2*effectiveTicks); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glPopMatrix(); @@ -406,6 +428,15 @@ void GLScope::paintGL() 1, 0, 0, 0 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glEnableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, vtx1); + glVertexAttribPointer(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, tex1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); + glDisableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vtx1); @@ -413,6 +444,7 @@ void GLScope::paintGL() glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); +#endif } #endif glDisable(GL_TEXTURE_2D); @@ -453,6 +485,15 @@ void GLScope::paintGL() 1, 0, 0, 0 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glEnableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, vtx1); + glVertexAttribPointer(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, tex1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); + glDisableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vtx1); @@ -460,6 +501,7 @@ void GLScope::paintGL() glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); +#endif } #endif glDisable(GL_TEXTURE_2D); @@ -508,11 +550,17 @@ void GLScope::paintGL() 0, m_triggerLevelDis1, 1, m_triggerLevelDis1 }; - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2); glDisableClientState(GL_VERTEX_ARRAY); +#endif } } #endif @@ -605,12 +653,17 @@ void GLScope::paintGL() } } } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINE_STRIP, 0, end - start); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINE_STRIP, 0, end - start); glDisableClientState(GL_VERTEX_ARRAY); - +#endif m_nbPow = end - start; } #endif @@ -675,11 +728,17 @@ void GLScope::paintGL() q3[2*i] = i - start; q3[2*i + 1] = v; } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINE_STRIP, 0, end - start); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINE_STRIP, 0, end - start); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glPopMatrix(); @@ -772,6 +831,15 @@ void GLScope::paintGL() 1, 0, 0, 0 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glEnableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, vtx1); + glVertexAttribPointer(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, tex1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); + glDisableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vtx1); @@ -779,6 +847,7 @@ void GLScope::paintGL() glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); +#endif } #endif glDisable(GL_TEXTURE_2D); @@ -813,11 +882,17 @@ void GLScope::paintGL() 0, 0, 1, 0 }; - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINE_LOOP, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINE_LOOP, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glDisable(GL_BLEND); @@ -861,11 +936,17 @@ void GLScope::paintGL() } } } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2*effectiveTicks); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2*effectiveTicks); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif // Vertical X2 @@ -900,11 +981,17 @@ void GLScope::paintGL() } } } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2*effectiveTicks); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2*effectiveTicks); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glPopMatrix(); @@ -944,6 +1031,15 @@ void GLScope::paintGL() 1, 0, 0, 0 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glEnableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, vtx1); + glVertexAttribPointer(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, tex1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); + glDisableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vtx1); @@ -951,6 +1047,7 @@ void GLScope::paintGL() glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); +#endif } #endif glDisable(GL_TEXTURE_2D); @@ -991,6 +1088,15 @@ void GLScope::paintGL() 1, 0, 0, 0 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glEnableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, vtx1); + glVertexAttribPointer(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, tex1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); + glDisableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vtx1); @@ -998,6 +1104,7 @@ void GLScope::paintGL() glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); +#endif } #endif glDisable(GL_TEXTURE_2D); @@ -1042,11 +1149,17 @@ void GLScope::paintGL() 0, m_triggerLevelDis2, 1, m_triggerLevelDis2 }; - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2); glDisableClientState(GL_VERTEX_ARRAY); +#endif } } #endif @@ -1110,11 +1223,17 @@ void GLScope::paintGL() q3[2*i] = x; q3[2*i+1] = y; } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINE_STRIP, 0, end - start); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINE_STRIP, 0, end - start); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glPopMatrix(); @@ -1160,11 +1279,17 @@ void GLScope::paintGL() q3[2*i] = i - start; q3[2*i+1] = v; } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINE_STRIP, 0, end - start); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINE_STRIP, 0, end - start); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif //glDisable(GL_LINE_SMOOTH); @@ -1457,6 +1582,15 @@ void GLScope::drawPowerOverlay() 1, 0, 0, 0 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glEnableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, vtx1); + glVertexAttribPointer(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, tex1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); + glDisableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vtx1); @@ -1464,6 +1598,7 @@ void GLScope::drawPowerOverlay() glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); +#endif } #endif glDisable(GL_TEXTURE_2D); diff --git a/sdrbase/gui/glspectrum.cpp b/sdrbase/gui/glspectrum.cpp index cbb2ac577..eb7ef9dec 100644 --- a/sdrbase/gui/glspectrum.cpp +++ b/sdrbase/gui/glspectrum.cpp @@ -24,6 +24,10 @@ #include +#ifdef GL_ANDROID +#include "util/gleshelp.h" +#endif + GLSpectrum::GLSpectrum(QWidget* parent) : QGLWidget(parent), m_cursorState(CSNormal), @@ -566,6 +570,16 @@ void GLSpectrum::paintGL() 1, prop_y, 0, prop_y }; + +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glEnableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, vtx1); + glVertexAttribPointer(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, tex1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); + glDisableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vtx1); @@ -573,6 +587,7 @@ void GLSpectrum::paintGL() glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); +#endif } #endif glDisable(GL_TEXTURE_2D); @@ -603,10 +618,17 @@ void GLSpectrum::paintGL() 0, 1 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glDisable(GL_BLEND); @@ -636,10 +658,17 @@ void GLSpectrum::paintGL() 1, 0 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINE_LOOP, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINE_LOOP, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glDisable(GL_BLEND); @@ -700,6 +729,15 @@ void GLSpectrum::paintGL() 1, 1, 0, 1 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glEnableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, vtx1); + glVertexAttribPointer(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, tex1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); + glDisableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vtx1); @@ -707,6 +745,7 @@ void GLSpectrum::paintGL() glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); +#endif } #endif glDisable(GL_TEXTURE_2D); @@ -740,10 +779,17 @@ void GLSpectrum::paintGL() 0, 1 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glPopMatrix(); @@ -770,11 +816,17 @@ void GLSpectrum::paintGL() 0.5, 0, 0.5, 1 }; - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glPopMatrix(); @@ -802,11 +854,17 @@ void GLSpectrum::paintGL() 0, 0, 1, 0 }; - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINE_LOOP, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINE_LOOP, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glDisable(GL_BLEND); @@ -850,6 +908,15 @@ void GLSpectrum::paintGL() 1, 0, 0, 0 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glEnableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, vtx1); + glVertexAttribPointer(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, tex1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); + glDisableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vtx1); @@ -857,6 +924,7 @@ void GLSpectrum::paintGL() glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); +#endif } #endif glDisable(GL_TEXTURE_2D); @@ -903,6 +971,15 @@ void GLSpectrum::paintGL() 1, 0, 0, 0 }; +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glEnableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, vtx1); + glVertexAttribPointer(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, tex1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); + glDisableVertexAttribArray(GL_TEXTURE_COORD_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vtx1); @@ -910,6 +987,7 @@ void GLSpectrum::paintGL() glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); +#endif } #endif glDisable(GL_TEXTURE_2D); @@ -946,11 +1024,17 @@ void GLSpectrum::paintGL() 1, 0.5, 0, 0.5 }; - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glDisable(GL_BLEND); @@ -978,11 +1062,17 @@ void GLSpectrum::paintGL() 0.5, 0, 0.5, 1 }; - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glPopMatrix(); @@ -1044,11 +1134,17 @@ void GLSpectrum::paintGL() q3[2*i] = (Real) i; q3[2*i+1] = v; } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + 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 //glDisable(GL_LINE_SMOOTH); @@ -1092,11 +1188,17 @@ void GLSpectrum::paintGL() q3[2*i] = (Real) i; q3[2*i+1] = v; } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + 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 //glDisable(GL_LINE_SMOOTH); @@ -1149,11 +1251,17 @@ void GLSpectrum::paintGL() } } } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2*effectiveTicks); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2*effectiveTicks); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif tickList = &m_frequencyScale.getTickList(); @@ -1187,11 +1295,17 @@ void GLSpectrum::paintGL() } } } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2*effectiveTicks); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2*effectiveTicks); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif @@ -1243,11 +1357,17 @@ void GLSpectrum::paintGL() } } } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2*effectiveTicks); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2*effectiveTicks); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif tickList = &m_frequencyScale.getTickList(); @@ -1281,11 +1401,17 @@ void GLSpectrum::paintGL() } } } - +#ifdef GL_ANDROID + glEnableVertexAttribArray(GL_VERTEX_ARRAY); + glVertexAttribPointer(GL_VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, q3); + glDrawArrays(GL_LINES, 0, 2*effectiveTicks); + glDisableVertexAttribArray(GL_VERTEX_ARRAY); +#else glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, q3); glDrawArrays(GL_LINES, 0, 2*effectiveTicks); glDisableClientState(GL_VERTEX_ARRAY); +#endif } #endif glPopMatrix();