I am an iOS developer, use Xcode to compile some GLSL code. The shaderv.vsh code likes below:
attribute vec4 position;
attribute vec4 positionColor;
attribute vec2 textCoordinate;
uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;
varying lowp vec2 varyTextCoord;
varying lowp vec4 varyColor;
void main() {
varyTextCoord = textCoordinate;
varyColor = positionColor;
vec4 vPos;
vPos = projectionMatrix * modelViewMatrix * position;
gl_Position = vPos;
}
And the shaderf.fsh code likes below:
precision lowp float;
varying lowp vec2 varyTextCoord;
varying lowp vec4 varyColor;
uniform sampler2D colorMap;
void main() {
vec4 cs = texture2D(colorMap,varyTextCoord);
vec4 cd = varyColor;
float s = 0.2;
float d = 0.5;
vec4 color = (cs * s) + (cd * d);
gl_FragColor = color;
}
When compile this code, it will be come into some error:
ERROR: 0:15: 'premature EOF' : syntax error syntax error
ERROR: 0:5: 'premature EOF' : syntax error syntax error
I can't find where is wrong. It has troubled me for a long time. Help me!