From 33abeb8097a8f80acd1a4ce94b4866e5dc41f0c0 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 17 May 2013 04:52:32 +0200 Subject: Fix Bug 737: Add shader default precision for GLSL [1.30 .. 1.50[ - See GLSL Spec [1.30 - 1.40]. --- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 4 +--- src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 4 ++-- src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java | 4 ++-- .../classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src/jogl/classes/jogamp') diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index f16834d28..8c9c12e21 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1056,9 +1056,7 @@ public abstract class GLContextImpl extends GLContext { } } if( ctxGLSLVersion.isZero() ) { - final int[] sver = new int[2]; - getStaticGLSLVersionNumber(major, minor, ctxOptions, sver); - ctxGLSLVersion = new VersionNumber(sver[0], sver[1], 0); + ctxGLSLVersion = getStaticGLSLVersionNumber(major, minor, ctxOptions); } } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 666cd30af..b90609ff1 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -149,8 +149,8 @@ public class MacOSXCGLContext extends GLContextImpl "../../shader", "../../shader/bin", shaderBasename, true); final ShaderCode fp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MacOSXCGLContext.class, "../../shader", "../../shader/bin", shaderBasename, true); - vp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp); - fp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp); + vp.defaultShaderCustomization(gl, true, true); + fp.defaultShaderCustomization(gl, true, true); sp.add(vp); sp.add(fp); if(!sp.link(gl, System.err)) { diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java index 20c251635..eaf8dc30a 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java @@ -69,8 +69,8 @@ public class GLSLTextureRaster { shaderSrcPath, shaderBinPath, shaderBasename, true); final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), shaderSrcPath, shaderBinPath, shaderBasename, true); - rsVp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp); - rsFp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp); + rsVp.defaultShaderCustomization(gl, true, true); + rsFp.defaultShaderCustomization(gl, true, true); // Create & Link the shader program sp = new ShaderProgram(); diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java index cc58f2363..f4f20ac7c 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java @@ -943,8 +943,8 @@ public class FixedFuncPipeline { private static final String constMaxTextures8 = "#define MAX_TEXTURE_UNITS 8\n"; private final void customizeShader(GL2ES2 gl, ShaderCode vp, ShaderCode fp, String maxTextureDefine) { - int rsVpPos = vp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp); - int rsFpPos = fp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp); + int rsVpPos = vp.defaultShaderCustomization(gl, true, true); + int rsFpPos = fp.defaultShaderCustomization(gl, true, true); vp.insertShaderSource(0, rsVpPos, maxTextureDefine); fp.insertShaderSource(0, rsFpPos, maxTextureDefine); } -- cgit v1.2.3