I'd like to write multiple values (not just the color and depth value) in one pass to avoid redundancy in vertex shader. Therefore, i attach multiple (let's say two) color buffers (e.g. textures) to a frame buffer object. As i read, GLES 3.0 supports GLSL 3.0 which supports layout( location = # ) qualifiers. However, the shaders do not compile with the error message "Typename expected, found 'layout'\n"
Simple fragment shader example:
uniform sampler2D uTexture;
varying vec3 vNormal;
layout( location = 0 ) out vec4 color;
layout( location = 1 ) out vec3 normal;
void main() {
color = texture2D( uTexture, vTexture );
normal = normalize( vNormal );
}
I would expect color going to GL_COLOR_ATTACHMENT0 and normal going to GL_COLOR_ATTACHMENT1. So, is there a way to avoid multiple passes in GLES 3.0?