hi there,
thanks but I don’t think you are addressing the issue I mentioned, which is why the editor complaining with :unknow type error.
I tried from the tests example_ColorBars.fsh and .vsh
This is the .fsh, no editor complains. All ok
#ifdef GL_ES
precision lowp float;
#endif
varying vec2 v_texCoord;
uniform sampler2D u_texture;
vec4 getColorByCoord(int y){
if(y < 5){
if(y == 0){
return vec4(1,0,0,1);
} else if(y == 1){
return vec4(0,1,0,1);
} else if(y == 2){
return vec4(0,0,1,1);
} else if(y == 3){
return vec4(0,1,1,1);
} else{
return vec4(1,0,1,1);
}
} else {
if(y == 5){
return vec4(1,1,0,1);
} else if(y == 6){
return vec4(1,1,1,1);
} else if(y == 7){
return vec4(1,0.5,0,1);
} else if(y == 8){
return vec4(1,0.5,0.5,1);
}else {
return vec4(0.5,0.5,1,1);
}
}
}
void main(void) {
// inline to prevent "float" loss and keep using lowp
//int y = int( mod(( (gl_FragCoord.y+gl_FragCoord.x)*mod(CC_Time[0],5.0)) / 10.0, 10.0 ) );
//int y = int( mod( CC_Time[3] + (gl_FragCoord.y + gl_FragCoord.x) / 10.0, 10.0 ) );
int y = int( mod(gl_FragCoord.y / 10.0, 10.0 ) );
gl_FragColor = getColorByCoord(y) * texture2D(u_texture, v_texCoord);
}
but with the following .vsh, complains about the error mentioned in the initial post
// http://www.cocos2d-iphone.org
attribute vec4 a_position;
attribute vec2 a_texCoord;
#ifdef GL_ES
varying mediump vec2 v_texCoord;
#else
varying vec2 v_texCoord;
#endif
uniform mat4 u_PMatrix;
void main()
{
gl_Position = u_PMatrix * a_position;
v_texCoord = a_texCoord;
}