Reputation: 133
I worked bevor on OpenGL ES on the IOS but now I want to try myself on OpenGl on the OS. I have really basic shaders for testing, but somehow, it won't compile? is there something I need to know about OpenGl, what is different there.
Here the shaders :
attribute vec4 position;
attribute vec2 texCoord;
attribute vec3 normal;
varying lowp vec2 vTexCoord;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform mat3 normalMatrix;
void main()
{
vTexCoord = texCoord;
gl_Position = projectionMatrix*modelViewMatrix * position;
}
Fragment:
uniform sampler2D uSampler;
varying lowp vec2 vTexCoord;
void main()
{
lowp vec4 texCol = texture2D(uSampler, vTexCoord);
gl_FragColor = vec4(texCol.rgba);
}
The error that comes is :
ERROR: 0:9: 'vec2' : syntax error: syntax error
Upvotes: 0
Views: 444
Reputation: 6766
Precision specifiers (lowp, mediump and highp) are part of GLSLES, not GLSL, so to compile on GLSL you should remove them.
If you want to use the same shader source across GLSL and GLSLES, then you could #define them away by including a string like this before the shader.
#define highp
#define mediump
#define lowp
Upvotes: 5