I have a webgl shader that uses multiple render targets. This one only renders to one texture for now. However, I plan that this shader shall render more. However, as soon as I add layout qualifiers, and #version 300 es, my shader stops working, because I get a message saying it is an invalid program.
#version 300 es
uniform mat4 viewProjectionMatrix;
attribute vec3 vertex;
attribute vec2 uv;
varying vec2 vUv;
void main() {
gl_Position = viewProjectionMatrix * vec4(vertex, 1);
vUv = uv;
}
Fragment shader
#version 300 es
precision mediump float;
layout(location = 0) out vec4 color;
uniform sampler2D textureId;
varying vec2 vUv;
void main() {
color = texture2D(textureId, vUv);
}