Description: Add OpenGL ES support.
Origin: upstream, https://github.com/mixxxdj/mixxx/pull/706
Last-Update: 2016-01-26

--- mixxx-2.0.0~dfsg.orig/SConstruct
+++ mixxx-2.0.0~dfsg/SConstruct
@@ -62,6 +62,9 @@ available_features = [features.Mad,
                       features.AsmLib,
                       features.IPod,
                       features.FFMPEG,
+
+		     # Experimental features
+		     features.OpenGLES
                       ]
 
 build = mixxx.MixxxBuild(target, machine, build_type,
--- mixxx-2.0.0~dfsg.orig/build/depends.py
+++ mixxx-2.0.0~dfsg/build/depends.py
@@ -844,11 +844,6 @@ class MixxxCore(Feature):
                    "waveform/renderers/waveformrendererrgb.cpp",
                    "waveform/renderers/qtwaveformrendererfilteredsignal.cpp",
                    "waveform/renderers/qtwaveformrenderersimplesignal.cpp",
-                   "waveform/renderers/glwaveformrendererfilteredsignal.cpp",
-                   "waveform/renderers/glwaveformrenderersimplesignal.cpp",
-                   "waveform/renderers/glslwaveformrenderersignal.cpp",
-                   "waveform/renderers/glvsynctestrenderer.cpp",
-                   "waveform/renderers/glwaveformrendererrgb.cpp",
 
                    "waveform/renderers/waveformsignalcolors.cpp",
 
@@ -856,6 +851,11 @@ class MixxxCore(Feature):
                    "waveform/renderers/waveformmark.cpp",
                    "waveform/renderers/waveformmarkset.cpp",
                    "waveform/renderers/waveformmarkrange.cpp",
+		   "waveform/renderers/glwaveformrenderersimplesignal.cpp",
+		   "waveform/renderers/glwaveformrendererrgb.cpp",
+		   "waveform/renderers/glwaveformrendererfilteredsignal.cpp",
+		   "waveform/renderers/glslwaveformrenderersignal.cpp",
+		   "waveform/renderers/glvsynctestrenderer.cpp",
 
                    "waveform/widgets/waveformwidgetabstract.cpp",
                    "waveform/widgets/emptywaveformwidget.cpp",
--- mixxx-2.0.0~dfsg.orig/build/features.py
+++ mixxx-2.0.0~dfsg/build/features.py
@@ -6,6 +6,25 @@ from mixxx import Feature
 import SCons.Script as SCons
 import depends
 
+class OpenGLES(Feature):
+	def description(self):
+		return "OpenGL-ES >= 2.0 support [Experimental]"
+
+	def enabled(self, build):
+		build.flags['opengles'] = util.get_flags(build.env, 'opengles', 0)
+		return int(build.flags['opengles'])
+
+	def add_options(self, build, vars):
+		vars.Add('opengles', 'Set to 1 to enable OpenGL-ES >= 2.0 support [Experimental]', 0)
+
+	def configure(self, build, conf):
+		if not self.enabled(build):
+          		return
+		if build.flags['opengles']:
+			build.env.Append(CPPDEFINES='__OPENGLES__')
+	
+	def sources(self, build):
+		return []
 
 class HSS1394(Feature):
     def description(self):
--- mixxx-2.0.0~dfsg.orig/src/waveform/renderers/glslwaveformrenderersignal.cpp
+++ mixxx-2.0.0~dfsg/src/waveform/renderers/glslwaveformrenderersignal.cpp
@@ -143,6 +143,8 @@ void GLSLWaveformRendererSignal::createG
     if (m_unitQuadListId != -1)
         return;
 
+#ifndef __OPENGLES__
+
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     glOrtho(-1.0, 1.0, -1.0, 1.0, -10.0, 10.0);
@@ -169,6 +171,8 @@ void GLSLWaveformRendererSignal::createG
         glEnd();
     }
     glEndList();
+
+#endif
 }
 
 void GLSLWaveformRendererSignal::createFrameBuffers()
@@ -275,6 +279,8 @@ void GLSLWaveformRendererSignal::draw(QP
 
     //qDebug() << "GAIN" << allGain << lowGain << midGain << highGain;
 
+#ifndef __OPENGLES__
+
     //paint into frame buffer
     {
         glMatrixMode(GL_PROJECTION);
@@ -346,7 +352,6 @@ void GLSLWaveformRendererSignal::draw(QP
         }
         glEnd();
 
-
         m_framebuffer->release();
 
         m_frameShaderProgram->release();
@@ -421,5 +426,7 @@ void GLSLWaveformRendererSignal::draw(QP
     glMatrixMode(GL_PROJECTION);
     glPopMatrix();
 
+#endif
+
     painter->endNativePainting();
 }
--- mixxx-2.0.0~dfsg.orig/src/waveform/renderers/glvsynctestrenderer.cpp
+++ mixxx-2.0.0~dfsg/src/waveform/renderers/glvsynctestrenderer.cpp
@@ -72,6 +72,8 @@ void GLVSyncTestRenderer::draw(QPainter*
     glEnable(GL_BLEND);
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
+#ifndef __OPENGLES__
+
     //t7 = timer.restart(); // 5,770
 
     glMatrixMode(GL_PROJECTION);
@@ -113,6 +115,8 @@ void GLVSyncTestRenderer::draw(QPainter*
     glMatrixMode(GL_PROJECTION);
     glPopMatrix();
 
+#endif
+
     //t12 = timer.restart(); // 22,426
     painter->endNativePainting();
 
--- mixxx-2.0.0~dfsg.orig/src/waveform/renderers/glwaveformrendererfilteredsignal.cpp
+++ mixxx-2.0.0~dfsg/src/waveform/renderers/glwaveformrendererfilteredsignal.cpp
@@ -70,6 +70,8 @@ void GLWaveformRendererFilteredSignal::d
     float maxHigh[2];
     float meanIndex;
 
+#ifndef __OPENGLES__
+
     if (m_alignment == Qt::AlignCenter) {
         glMatrixMode(GL_PROJECTION);
         glPushMatrix();
@@ -198,5 +200,8 @@ void GLWaveformRendererFilteredSignal::d
     glPopMatrix();
     glMatrixMode(GL_PROJECTION);
     glPopMatrix();
+
+#endif
+
     painter->endNativePainting();
 }
--- mixxx-2.0.0~dfsg.orig/src/waveform/renderers/glwaveformrendererrgb.cpp
+++ mixxx-2.0.0~dfsg/src/waveform/renderers/glwaveformrendererrgb.cpp
@@ -63,6 +63,8 @@ void GLWaveformRendererRGB::draw(QPainte
 
     const float kHeightScaleFactor = 255.0 / sqrtf(255 * 255 * 3);
 
+#ifndef __OPENGLES__
+
     if (m_alignment == Qt::AlignCenter) {
         glMatrixMode(GL_PROJECTION);
         glPushMatrix();
@@ -191,5 +193,8 @@ void GLWaveformRendererRGB::draw(QPainte
     glPopMatrix();
     glMatrixMode(GL_PROJECTION);
     glPopMatrix();
+
+#endif
+
     painter->endNativePainting();
 }
--- mixxx-2.0.0~dfsg.orig/src/waveform/renderers/glwaveformrenderersimplesignal.cpp
+++ mixxx-2.0.0~dfsg/src/waveform/renderers/glwaveformrenderersimplesignal.cpp
@@ -59,6 +59,8 @@ void GLWaveformRendererSimpleSignal::dra
     // Reset device for native painting
     painter->beginNativePainting();
 
+#ifndef __OPENGLES__
+
     glEnable(GL_BLEND);
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
@@ -154,5 +156,8 @@ void GLWaveformRendererSimpleSignal::dra
     glPopMatrix();
     glMatrixMode(GL_PROJECTION);
     glPopMatrix();
+
+#endif
+
     painter->endNativePainting();
 }
