I have this vertex shader:
uniform mat4 u_Matrix;
attribute vec4 v_Position;
attribute vec4 v_Position1;
attribute vec2 a_texCoord;
attribute vec2 a_texCoord1;
varying vec2 v_texCoord;
varying vec2 v_texCoord1;
void main() {
gl_Position = u_Matrix * v_Position * v_Position1; /*I guess that this is not possible.*/
v_texCoord = a_texCoord;
v_texCoord1 = a_texCoord1;
}
And this fragment shader:
precision mediump float;
varying vec2 v_texCoord;
varying vec2 v_texCoord2;
uniform sampler2D u_texture;
uniform sampler2D u_texture2;
vec4 col1;
vec4 col2;
void main() {
col1 = texture2D(u_texture, v_texCoord);
col2 = texture2D(u_texture2, v_texCoord2);
gl_FragColor = col1 + col2;
}
What I want is to have two or more arrays of data and UV coordinates, and pass each one independently to the same program (vertex and fragment shader). Obviously I’m doing something wrong in the shaders, because when I run the app a black screen is shown instead of the textures.