I am playing around with WebGL trying to learn it, so I took some code from a webgl tutorial, and tried to add my own lines, but whenever I run it, it gives me this error:

.WebGLRenderingContext: GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 0 

Note: attribute 0 is my vertex buffer

My buffer initialization code is (obviously assume global vars if there is no definition)

    cubeVertexPositionBuffer = gl.createBuffer(); // create a buffer
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer);

//for laziness
var _f=1.0/3.0;

vertices = [ // this is code from the tutorial
// Front face
-1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, 1.0,
// Back face
-1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, -1.0,
// Top face
-1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0,
// Bottom face
-1.0, -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, -1.0, 1.0,
// Right face
1.0, -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0,
// Left face
-1.0, -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 

// this is my own code
-1.0+  _f, -1.0, 1.0,   -1.0+  _f, -1.0, -1.0,
-1.0+2*_f, -1.0, 1.0,   -1.0+2*_f, -1.0, -1.0,
-1.0+3*_f, -1.0, 1.0,   -1.0+3*_f, -1.0, -1.0,
-1.0+4*_f, -1.0, 1.0,   -1.0+4*_f, -1.0, -1.0,
-1.0+5*_f, -1.0, 1.0,   -1.0+5*_f, -1.0, -1.0


];
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices),
        gl.STATIC_DRAW);
cubeVertexPositionBuffer.itemSize = 3;
cubeVertexPositionBuffer.numItems = 34;

    // color buffer code is irrelevant because my color buffer is attribute 1 not 0
    // plus it's all copied from the tutorial

    // index buffer 
    // note I changed some code so the cube drawn is wireframe instead of solid
    // I tested that without extra vertex or index buffer data and it worked
    cubeVertexIndexBuffer = gl.createBuffer(); // this modified a bit from the tutorial
g
Edit
Report