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);