commit c25273e0769f910c04097d2ac700214d3e2790f1
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri Jun 29 15:03:36 2018 +0100

    Standarize GLSL version across the whole library.

diff --git a/src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java b/src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java
index 1b8b870..fbdf36f 100644
--- a/src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java
+++ b/src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java
@@ -21,6 +21,7 @@ package org.distorted.library.effect;
 
 import android.opengl.GLES31;
 
+import org.distorted.library.main.Distorted;
 import org.distorted.library.main.DistortedFramebuffer;
 import org.distorted.library.main.DistortedOutputSurface;
 import org.distorted.library.main.DistortedRenderState;
@@ -233,7 +234,7 @@ public class PostprocessEffectBlur extends PostprocessEffect
     {
     final String blurVertex =
 
-      "#version 300 es        \n"+
+        Distorted.GLSL_VERSION   +
       "precision lowp float;  \n"+
       "in vec2 a_Position;    \n"+
       "in vec2 a_TexCoord;    \n"+
@@ -249,7 +250,7 @@ public class PostprocessEffectBlur extends PostprocessEffect
 
     final String blurFragment1 =
 
-      "#version 300 es                    \n"+
+        Distorted.GLSL_VERSION               +
       "#define MAX_BLUR "+MAX_HALO+      "\n"+
       "precision lowp float;              \n"+
       "in vec2 v_TexCoord;                \n"+
@@ -272,7 +273,7 @@ public class PostprocessEffectBlur extends PostprocessEffect
 
     final String blurFragment2 =
 
-      "#version 300 es                    \n"+
+        Distorted.GLSL_VERSION               +
       "#define MAX_BLUR "+MAX_HALO+      "\n"+
       "precision lowp float;              \n"+
       "in vec2 v_TexCoord;                \n"+
diff --git a/src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java b/src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java
index e2235e3..a76b0d9 100644
--- a/src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java
+++ b/src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java
@@ -21,6 +21,7 @@ package org.distorted.library.effect;
 
 import android.opengl.GLES31;
 
+import org.distorted.library.main.Distorted;
 import org.distorted.library.main.DistortedEffects;
 import org.distorted.library.main.DistortedFramebuffer;
 import org.distorted.library.main.DistortedOutputSurface;
@@ -249,7 +250,7 @@ public class PostprocessEffectGlow extends PostprocessEffect
     {
     final String glowVertex =
 
-      "#version 300 es        \n"+
+        Distorted.GLSL_VERSION   +
       "precision lowp float;  \n"+
       "in vec2 a_Position;    \n"+
       "in vec2 a_TexCoord;    \n"+
@@ -265,7 +266,7 @@ public class PostprocessEffectGlow extends PostprocessEffect
 
     final String glowFragment1 =
 
-      "#version 300 es                    \n"+
+        Distorted.GLSL_VERSION               +
       "#define MAX_BLUR "+MAX_HALO+      "\n"+
       "precision lowp float;              \n"+
       "in vec2 v_TexCoord;                \n"+
@@ -289,7 +290,7 @@ public class PostprocessEffectGlow extends PostprocessEffect
 
     final String glowFragment2 =
 
-      "#version 300 es                    \n"+
+        Distorted.GLSL_VERSION               +
       "#define MAX_BLUR "+MAX_HALO+      "\n"+
       "precision lowp float;              \n"+
       "in vec2 v_TexCoord;                \n"+
diff --git a/src/main/java/org/distorted/library/main/Distorted.java b/src/main/java/org/distorted/library/main/Distorted.java
index b1a4283..63f797f 100644
--- a/src/main/java/org/distorted/library/main/Distorted.java
+++ b/src/main/java/org/distorted/library/main/Distorted.java
@@ -35,8 +35,8 @@ import org.distorted.library.effect.VertexEffect;
  */
 public class Distorted 
   {
-  static int GLSL;
-  static String GLSL_VERSION;
+  public static final int GLSL = 310;
+  public static final String GLSL_VERSION= "#version 310 es\n";
   /**
    * When creating an instance of a DistortedTexture from another instance, clone the Bitmap that's
    * backing up our DistortedTexture.
@@ -128,13 +128,11 @@ public class Distorted
     android.util.Log.e("DISTORTED", "GL Vendor "   +GLES31.glGetString(GLES31.GL_VENDOR));
     android.util.Log.e("DISTORTED", "GL Renderer " +GLES31.glGetString(GLES31.GL_RENDERER));
     */
-    GLSL = ( (configurationInfo.reqGlEsVersion>>16)>=3 ? 310 : 100 );
-    GLSL_VERSION= (GLSL==100 ? "#version 100\n" : "#version 310 es\n");
-
     EffectMessageSender.startSending();
 
     final Resources resources = context.getResources();
-    DistortedEffects.createProgram(resources);
+    DistortedEffects.createPrograms(resources);
+    DistortedEffects.createProgramsOIT(resources);
     PostprocessEffect.createPrograms();
 
     mInitialized = true;
diff --git a/src/main/java/org/distorted/library/main/DistortedEffects.java b/src/main/java/org/distorted/library/main/DistortedEffects.java
index fe9e865..060d778 100644
--- a/src/main/java/org/distorted/library/main/DistortedEffects.java
+++ b/src/main/java/org/distorted/library/main/DistortedEffects.java
@@ -130,7 +130,7 @@ public class DistortedEffects
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  static void createProgram(Resources resources)
+  static void createPrograms(Resources resources)
     {
     // MAIN PROGRAM ////////////////////////////////////
     final InputStream mainVertStream = resources.openRawResource(R.raw.main_vertex_shader);
@@ -206,6 +206,28 @@ public class DistortedEffects
     mBlitDepthDepthH        = GLES31.glGetUniformLocation( blitDepthProgramH, "u_Depth");
     mBlitDepthTexCorrH      = GLES31.glGetUniformLocation( blitDepthProgramH, "u_TexCorr");
 
+    // NORMAL PROGRAM //////////////////////////////////////
+    final InputStream normalVertexStream   = resources.openRawResource(R.raw.normal_vertex_shader);
+    final InputStream normalFragmentStream = resources.openRawResource(R.raw.normal_fragment_shader);
+
+    try
+      {
+      mNormalProgram = new DistortedProgram(normalVertexStream,normalFragmentStream, Distorted.GLSL_VERSION, Distorted.GLSL_VERSION, Distorted.GLSL);
+      }
+    catch(Exception e)
+      {
+      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile NORMAL program: "+e.getMessage());
+      throw new RuntimeException(e.getMessage());
+      }
+
+    int normalProgramH = mNormalProgram.getProgramHandle();
+    mNormalMVPMatrixH  = GLES31.glGetUniformLocation( normalProgramH, "u_MVPMatrix");
+    }
+
+  ///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  static void createProgramsOIT(Resources resources)
+    {
     // OIT CLEAR PROGRAM ////////////////////////////////////
     final InputStream oitClearVertStream = resources.openRawResource(R.raw.oit_vertex_shader);
     final InputStream oitClearFragStream = resources.openRawResource(R.raw.oit_clear_fragment_shader);
@@ -303,23 +325,6 @@ public class DistortedEffects
     mOITRenderDepthH        = GLES31.glGetUniformLocation( oitRenderProgramH, "u_Depth");
     mOITRenderTexCorrH      = GLES31.glGetUniformLocation( oitRenderProgramH, "u_TexCorr");
     mOITRenderSizeH         = GLES31.glGetUniformLocation( oitRenderProgramH, "u_Size");
-
-    // NORMAL PROGRAM //////////////////////////////////////
-    final InputStream normalVertexStream   = resources.openRawResource(R.raw.normal_vertex_shader);
-    final InputStream normalFragmentStream = resources.openRawResource(R.raw.normal_fragment_shader);
-
-    try
-      {
-      mNormalProgram = new DistortedProgram(normalVertexStream,normalFragmentStream, Distorted.GLSL_VERSION, Distorted.GLSL_VERSION, Distorted.GLSL);
-      }
-    catch(Exception e)
-      {
-      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile NORMAL program: "+e.getMessage());
-      throw new RuntimeException(e.getMessage());
-      }
-
-    int normalProgramH = mNormalProgram.getProgramHandle();
-    mNormalMVPMatrixH  = GLES31.glGetUniformLocation( normalProgramH, "u_MVPMatrix");
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
