Hi all!
I’m fighting with OpenGL log and wonder if I could not simply ask you OpenGL ES 2 guru.
Is anyone could told me why this GLSL shader won’t compile on OpenGL ES 2 devices (GCW Zero in this case but I have the same problem on any other)?
I copy paste the shader here:
#version 100
precision lowp float;
uniform vec4 uBlendColor;
uniform vec4 uPrimColor;
uniform vec4 uEnvColor;
uniform vec3 uChromaKeyCenter;
uniform vec3 uChromaKeyScale;
uniform vec3 uChromaKeyWidth;
uniform float uLodFrac;
uniform float uPrimLodFrac;
uniform float uK5;
uniform float uK4;
uniform sampler2D uTex0;
uniform sampler2D uTex1;
uniform vec4 uFogColor;
varying vec2 vertexTexCoord0;
varying vec2 vertexTexCoord1;
varying float vertexFog;
varying vec4 vertexShadeColor;
void main()
{
vec4 outColor;
vec3 AColor = texture2D(uTex0,vertexTexCoord0).rgb;
vec3 BColor = vec3(0.0);
vec3 CColor = vertexShadeColor.rgb;
vec3 DColor = vec3(0.0);
float AAlpha = 0.0;
float BAlpha = 0.0;
float CAlpha = 0.0;
float DAlpha = vertexShadeColor.a;
vec3 cycle1Color = (AColor - BColor) * CColor + DColor;
float cycle1Alpha = (AAlpha - BAlpha) * CAlpha + DAlpha;
outColor.rgb = cycle1Color;
outColor.a = cycle1Alpha;
float coverage = 1.0;
coverage = step( 0.5, coverage );
outColor.a = coverage;
if( coverage < 0.1 ) discard;
gl_FragColor = outColor;
}
As you guess, I have no GLES 2 device for me and just make peoples having such compile and test my code… Not the best way I know.
For the tiny story, this is a shader dynamically generated to emulate the “N64 GPU” (kindof…). This explain why there is such a big number of uniform not used in the main(). Those inputs are always present in every dynamically generated GLSL shaders. I don’t think those are the problem but as I’m not very confortable with embedded devices I ask.
Any hint or feedback is welcome.