This is a strange problem. If I try to pass a uniform color to the fragment shader, i get a compile error
uniform vec4 uniformColor;
void main(){
gl_FragColor = uniformColor;
}
But if I pass the same uniform color to the vertex shader then pass it to the fragment shader via a varying, then it works fine..
attribute vec4 position;
uniform mat4 matrix;
uniform vec4 uniformColor;
varying vec4 fragmentColor;
void main()
{
gl_Position = matrix * position;
fragmentColor = uniformColor;
}
and
varying lowp vec4 fragmentColor;
void main()
{
gl_FragColor = fragmentColor;
}
this is on an iOS.
I'm a little confused as copying and pasting examples from online gives me errors.
lowp
,mediump
, etc.)? Also, what error message do you get on shader compilation? – keaukraine