shaders = {
const vs = `#version 300 es // Declare the version we are working in
in vec2 position; // Attribute for postions
in vec3 normal; // Attribute for the normals
uniform float aspect; // Window aspect ratio: window.width/window.height
out vec3 fragNormal; // Variable whose value will be associated with the gl_position.
void main () {
gl_Position = vec4(position.x/aspect, position.y, 0, 1); // gl_Position must be set with a vec4 value.
fragNormal = normalize(normal); // Normalize the normals
}`;
const fs = `#version 300 es // Again we must declare the version we are working with
precision mediump float; // Set the precision inside the fragment shader
in vec3 fragNormal; // Input for the normals
out vec4 outColor; // User-defined output variable for
void main () {
vec3 N = normalize(fragNormal); // Normalize the normals
vec3 color = (N+1.0)/2.0;
outColor = vec4(abs(N), 1);
}`;
return [vs, fs];
}