From bc626097469e68ad68f1c26ac9f365fa8574d39f Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Wed, 20 Feb 2013 22:31:15 +0000 Subject: [PATCH] OGLESShaderRenderer now only force mediump precision for float in the fragment shader. Default precision for the vertex shader for float is highp. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10422 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../renderer/android/OGLESShaderRenderer.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java b/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java index c615be13d..4f05547a8 100644 --- a/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java +++ b/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java @@ -783,12 +783,22 @@ public class OGLESShaderRenderer implements Renderer { id, source.getDefines() + source.getSource()); } else { + String precision =""; + if (source.getType() == ShaderType.Fragment) { + precision = "precision mediump float;\n"; + } GLES20.glShaderSource( - id, - "precision mediump float;\n" - + source.getDefines() + id, + precision + +source.getDefines() + source.getSource()); } +// int range[] = new int[2]; +// int precision[] = new int[1]; +// GLES20.glGetShaderPrecisionFormat(GLES20.GL_VERTEX_SHADER, GLES20.GL_HIGH_FLOAT, range, 0, precision, 0); +// System.out.println("PRECISION HIGH FLOAT VERTEX"); +// System.out.println("range "+range[0]+"," +range[1]); +// System.out.println("precision "+precision[0]); GLES20.glCompileShader(id); GLES20.glGetShaderiv(id, GLES20.GL_COMPILE_STATUS, intBuf1);