I created an application with sdl 2.0 and initialized opengl with version 2.0 like this:
SDL_GL_SetAttribute ( SDL_GL_CONTEXT_MAJOR_VERSION, 2 );
SDL_GL_SetAttribute ( SDL_GL_CONTEXT_MINOR_VERSION, 0 );
Then I found some simple diffuse shader on internet:
attribute highp vec3 inVertex;
attribute mediump vec3 inNormal;
attribute mediump vec2 inTexCoord;
uniform highp mat4 MVPMatrix;
uniform mediump vec3 LightDirection;
varying lowp float LightIntensity;
varying mediump vec2 TexCoord;
void main()
{
//Transform position
gl_Position = MVPMatrix * vec4(inVertex, 1.0);
//Pass through texcoords
TexCoord = inTexCoord;
//Simple diffuse lighting in model space
LightIntensity = dot(inNormal, -LightDirection);
}
it failed to compile with error like this:
error: syntax error, unexpected NEW_IDENTIFIER
Then I found after I remove
highp mediump lowp
it compiles fine and runs ok, 1.what was the reason for that? another question: 2.Can I still run this shader both on linux and android? I am using linux now everything runs good. thanks