title: Using emscripten with opengl shaders
body: <p>I am having trouble getting emscripten to work with openGL shaders. The project compiles just fine with both emscripten and gcc but fails when I try to run the emscripten output.</p>
  
  <p>The errors I get from compiling the vertex shader:</p>
  
  <pre><code>ERROR: 0:1: 'core' : invalid version directive 
  ERROR: 0:3: 'layout' : syntax error 
  </code></pre>
  
  <p>The errors I get from compiling the fragment shader:</p>
  
  <pre><code>ERROR: 0:1: 'core' : invalid version directive 
  ERROR: 0:3: 'in' : storage qualifier supported in GLSL ES 3.00 only  
  ERROR: 0:3: '' : No precision specified for (float) 
  ERROR: 0:5: 'out' : storage qualifier supported in GLSL ES 3.00 only   
  ERROR: 0:5: '' : No precision specified for (float) 
  </code></pre>
  
  <p>I'm compiling this project with the command:</p>
  
  <pre><code>em++ src/*.cpp -Iinclude/ -o test.html -std=c++11 -s USE_GLFW=3 -s FULL_ES3=1
  </code></pre>
  
  <p>Vertex shader source:</p>
  
  <pre><code>#version 330 core
  
  layout (location = 0) in vec3 position; 
  layout (location = 1) in vec3 in_color;
  
  uniform mat4 model; 
  uniform mat4 projection;
  
  out vec3 out_color;
  
  void main()
  {
      gl_Position = projection * model * vec4(position, 1.0f);
      out_color = in_color;
  }
  </code></pre>
  
  <p>Fragment shader source:</p>
  
  <pre><code>#version 330 core
  
  in vec3 out_color;
  
  out vec4 color;
  
  void main()
  {
        color = vec4(out_color, 1.0);
  }
  </code></pre>
  
  <p>The shaders are loaded as char arrays from output provided by <code>xxd -i</code> I'm working in c++11 on linux. The program works just fine when I run it natively and I've tried running the emscripten output in both Firefox and chromium.</p>
  
  <p>It seems to be a problem between different versions. Is there a way to make emscripten work with what I currently have, or do I have to write my shaders differently? And if I do have to rewrite my shaders, how should I write them?</p>