glDrawElements/glDrawRangeElement not drawing

Hi all,
I am trying to load a 3d model in using VAO and vbo. From the model, I load the vertices, uv coords. and indices into std::vector. My vao is setup like this


//gen vao and vbo stuff
glGenBuffers(1, &vboVerticesID);
glGenBuffers(1, &vboIndicesID); 
glGenVertexArrays(1, &vaoID);
glBindVertexArray(vaoID);	
  glBindBuffer(GL_ARRAY_BUFFER, vboVerticesID);
  glBufferData(GL_ARRAY_BUFFER, sizeof(vertices)+sizeof(uvs), NULL, GL_STATIC_DRAW);

  glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), (const GLvoid*)&vertices[0]);
  glBufferSubData(GL_ARRAY_BUFFER, sizeof(vertices), sizeof(uvs), (const GLvoid*)&uvs[0]);

  glVertexAttribPointer(0,3,GL_FLOAT, GL_FALSE, 0, 0);
  //positions
  glVertexAttribPointer(1,2,GL_FLOAT, GL_FALSE, 0, (const GLvoid*)sizeof(vertices));	//uv coordinates
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIndicesID);
  glBufferData(GL_ELEMENT_ARRAY_BUFFER,sizeof(faces), &faces[0], GL_STATIC_DRAW);
glBindVertexArray(0);	

Then this is my draw call in the render func. but it displays nothing and my framerate is 1-3 fps?


glBindVertexArray(vaoID);
  glDrawElements(GL_TRIANGLES, faces.size(), GL_UNSIGNED_SHORT, 0);
//glDrawRangeElements(GL_TRIANGLES, 0, faces.size()-1, faces.size(), GL_UNSIGNED_SHORT, 0);
glBindVertexArray(0);

Ok to check,I have removed vao completely and instead of loading my mesh I am trying to load a simple cude as follows.


glGenBuffers(1, &vboVerticesID);
glGenBuffers(1, &vboIndicesID); 

GLfloat vertices [3*4*6]= {
// Front face
-0.5, -0.5,  0.5,
 0.5, -0.5,  0.5,
 0.5,  0.5,  0.5,
-0.5,  0.5,  0.5,

// Back face
-0.5, -0.5, -0.5,
-0.5,  0.5, -0.5,
 0.5,  0.5, -0.5,
 0.5, -0.5, -0.5,

// Top face
-0.5,  0.5, -0.5,
-0.5,  0.5,  0.5,
 0.5,  0.5,  0.5,
 0.5,  0.5, -0.5,

// Bottom face
-0.5, -0.5, -0.5,
 0.5, -0.5, -0.5,
 0.5, -0.5,  0.5,
-0.5, -0.5,  0.5,
// Right face
 0.5, -0.5, -0.5,
 0.5,  0.5, -0.5,
 0.5,  0.5,  0.5,
 0.5, -0.5,  0.5,
// Left face
-0.5, -0.5, -0.5,
-0.5, -0.5,  0.5,
-0.5,  0.5,  0.5,
-0.5,  0.5, -0.5,
};

GLushort indices[36] = {
0, 1, 2,      0, 2, 3,    // Front face
4, 5, 6,      4, 6, 7,    // Back face
8, 9, 10,     8, 10, 11,  // Top face
12, 13, 14,   12, 14, 15, // Bottom face
16, 17, 18,   16, 18, 19, // Right face
20, 21, 22,   20, 22, 23  // Left face
};
glBindBuffer(GL_ARRAY_BUFFER, vboVerticesID);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIndicesID);
glBufferData(GL_ELEMENT_ARRAY_BUFFER,sizeof(indices), indices, GL_STATIC_DRAW);

and this code in render func.


glBindBuffer(GL_ARRAY_BUFFER, vboVerticesID);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIndicesID);
   glDrawElements(GL_TRIANGLES, 6*2*3, GL_UNSIGNED_SHORT, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

but even this is not displaying anything.

Hi,
I was missing the call to


glEnableVertexAttribArray(0);

This shows the cube fine however the model is still not loaded. I see the whole screen white?

After surfing through the web and looking through all legacy(enableclientstate vertex array stuff), I came across this modern and wonderful online book esp. this section may be this will solve my problem
http://www.arcsynthesis.org/gltut/Positioning/Tutorial%2005.html

OK problem solved. I thought the sizeof operator for vector would give me the same result as the sizeof operator for arrays but it does not. The correct solution is to do soemthing like this if the vertices std::vector has 3 comp. of float type,

int size = vertices.size()*3*sizeof(float);

problem solved!!!