title: WebGL: no VBO bound to enabled vertex. Do I need "vertexAttribPointer" for vertex indices?
body: <p><strong>Edit:</strong> This is not a firefox bug only, I get the same errors in chrome aswell</p>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>WebGL warning: drawElements: no VBO bound to enabled vertex attrib index 1u!</p>
  </blockquote>
  
  <p>I looked around the net and it looks like the indices buffer needs a "vertexAttribPointer", but I can't find any place that explains that so I'm still unsure.</p>
  
  <p>And this is my vbo render function:</p>
  
  <pre><code>g.activeTexture(g.TEXTURE0);
  g.bindTexture(g.TEXTURE_2D, obj.texture);
  g.uniform1i(g.getUniformLocation(shaderProgram, 'uSampler'), 0);
  g.vertexAttribPointer(
      textureCoordAttribute, 2, g.FLOAT, g.FALSE, 0, 0 );
  
  //vertices
  g.bindBuffer(g.ARRAY_BUFFER, obj.vertBuffer);
  g.vertexAttribPointer(
      positionAttribLocation, obj.vertSize, g.FLOAT, g.FALSE, 0, 0 );
  
  //white color
  g.bindBuffer(g.ARRAY_BUFFER, whiteColorBuffer);
  g.vertexAttribPointer(
      colorAttribLocation, 4, g.FLOAT, g.FALSE, 0, 0 );
  
  //Texture coords
  g.bindBuffer(g.ARRAY_BUFFER, obj.textureBuffer);
  g.vertexAttribPointer(
      textureCoordAttribute, 2, g.FLOAT, g.FALSE, 0, 0 );
  
  //indices buffer
  g.bindBuffer(g.ELEMENT_ARRAY_BUFFER, obj.indexBuffer);
  setMatrixUniforms();
  
  g.drawElements(g.TRIANGLES, obj.indexNumItems, g.UNSIGNED_SHORT, 0);
  g.bindTexture(g.TEXTURE_2D, null);
  g.bindBuffer(g.ARRAY_BUFFER, null);
  g.bindBuffer(g.ELEMENT_ARRAY_BUFFER, null);
  </code></pre>
  
  <p>The indices array is correct and vertex array since it worked without textures before(although it rendered only half of the vertices).</p>
  
  <p>Do I have to add indices variables to the shaders?</p>
  
  <p>Edit2: This is how my <code>getAttribLocations</code> currently look like:</p>
  
  <pre><code>positionAttribLocation = g.getAttribLocation(shaderProgram, "vertPosition");
  colorAttribLocation = g.getAttribLocation(shaderProgram, "vertColor");
  textureCoordAttribute = g.getAttribLocation(shaderProgram, "aTextureCoord");
  
  
  g.vertexAttribPointer(
      positionAttribLocation, // attribute location
      2, //number of elements per attribute
      gl.FLOAT, // type of element
      gl.FALSE,
      5 * Float32Array.BYTES_PER_ELEMENT,//size of induvidual vertex
      0//offset from the beginning of a single vertex to this attribute
      );
  g.vertexAttribPointer(
      colorAttribLocation,
      3,
      g.FLOAT,
      g.FALSE,
      5 * Float32Array.BYTES_PER_ELEMENT,
      2 * Float32Array.BYTES_PER_ELEMENT
      );
  g.vertexAttribPointer(
      textureCoordAttribute,
      2, 
      g.FLOAT,
      g.FALSE,
      0,
      0
  );
  g.enableVertexAttribArray(positionAttribLocation);
  g.enableVertexAttribArray(colorAttribLocation);
  g.enableVertexAttribArray(textureCoordAttribute);
  </code></pre>