I am using openGl ES 3.0 in android to render a rect on screen, and I want to use shaders to generate a mix of colors depending on vertex positions.
I am sure that the problem is in the vertex and in the fragment shader code, but I don't know what is it, these are the shader codes:
private final String vertexShaderCode =
"#version 300 es"+
"in vec3 position;" +
"out vec3 color;"+
"void main() {" +
" gl_Position = vec4(position.x,position.y,position.z,1.0);" +
" color = vec3(position.x+0.5,1.0,position.y+0.5);"+
"}";
private final String fragmentShaderCode =
"#version 300 es"+
"in vec3 color;"+
"out vec4 out_color;"+
"void main() {" +
" out_color= vec4(color.x,color.y,color.z,1.0);" +
"}";
I am trying to fill the shape with color based on vertex position, so its a mixture of generated colors for each pixel.
But I don't why its not working?
UPDATE:
I have 3 info:
Link failed because of invalid vertex shader.
Language version '300' unknown, this compiler only supports up to version '320 es'
Unexpected text found after #version directive.