title: Why does Shader not work in html5 module but works in desktop app?
body: <p>Following this tutorial <a href="https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-Meshes-Lesson-1" rel="nofollow noreferrer">https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-Meshes-Lesson-1</a> on rendering Meshes. It works fine on Desktop Application, but deployed to html5 its all black and spams:</p>
  
  <blockquote>
    <p>.WebGL-000001FC218B3370]GL ERROR :GL_INVALID_OPERATION : glDrawArrays: attempt to access out of range vertices in attribute 0</p>
  </blockquote>
  
  <p>Why does it not work? I am not using an array in the shader.</p>
  
  <p>Im using this simple shader which is just supposed to render position and color of a vertex:</p>
  
  <p>Vertex shader</p>
  
  <pre><code>    //our attributes
  attribute vec2 a_position;
  attribute vec4 a_color;
  
  //our camera matrix
  uniform mat4 u_projTrans;
  
  //send the color out to the fragment shader
  varying vec4 vColor;
  
  void main() {
      vColor = a_color;
      gl_Position = u_projTrans * vec4(a_position.xy, 0.0, 1.0);
  }
  </code></pre>
  
  <p>Fragment shader</p>
  
  <pre><code>#ifdef GL_ES
  precision mediump float;
  #endif
  
  //input from vertex shader
  varying vec4 vColor;
  
  void main() {
      gl_FragColor = vColor;
  }
  </code></pre>
  
  <p>Rendering like this</p>
  
  <pre><code>triangle.mesh.render(shaderProgram, GL20.GL_TRIANGLES, 0, 18 / NUM_COMPONENTS);
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>My vertex specification</p>
  
  <pre><code>public static final int MAX_TRIS = 1;
  public static final int MAX_VERTS = MAX_TRIS * 3;
  
  // ...
  
  protected float[] verts = new float[MAX_VERTS * NUM_COMPONENTS];
  
  mesh = new Mesh(true, MAX_VERTS, 0,
                      new VertexAttribute(VertexAttributes.Usage.Position, 2, "a_position"),
                      new VertexAttribute(VertexAttributes.Usage.ColorPacked, 4, "a_color"));
  
  float c = color.toFloatBits();
  
  idx = 0;
  
  verts[idx++] = coordinates[0].x;
  verts[idx++] = coordinates[0].y;
  verts[idx++] = c;
  
  //top left vertex
  verts[idx++] = coordinates[1].x;
  verts[idx++] = coordinates[1].y;
  verts[idx++] = c;
  
  //bottom right vertex
  verts[idx++] = coordinates[2].x;
  verts[idx++] = coordinates[2].y;
  verts[idx++] = c;
  
  mesh.setVertices(verts);
  </code></pre>
  
  <p>My draw call</p>
  
  <pre><code>public void render() {
          Gdx.gl.glDepthMask(false);
          Gdx.gl.glEnable(GL20.GL_BLEND);
  
          shaderProgram.begin();  // shaderprogram contains vertex and fragment shader
          shaderProgram.setUniformMatrix("u_projTrans", world.renderer.getCam().combined);
          for (Triangle triangle : triangles) {
              triangle.mesh.render(shaderProgram, GL20.GL_TRIANGLES, 0, 18 / NUM_COMPONENTS);
  
          }
          shaderProgram.end();
          Gdx.gl.glDepthMask(true);
      }
  </code></pre>