我尝试编译这个着色器:
varying vec2 TexCoords;
varying vec4 color;
uniform sampler2D text;
uniform vec3 textColor;
void main()
{
vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, TexCoords).r);
color = vec4(textColor, 1.0) * sampled;
}
这是关于OpenGL ES的内容。我遇到的错误如下:
ERROR: 0:2: 'vec2' : No precision defined for this type
ERROR: 0:3: 'vec4' : No precision defined for this type
ERROR: 0:6: 'vec3' : No precision defined for this type
ERROR: 0:10: 'texture' : undeclared identifier
ERROR: 0:10: invalid function call
请注意,它能在OpenGL 3.3上编译通过,但无法在es上编译通过。