I'm creating some vertex data using a vector<GLfloat>:
static vector<GLfloat> vertices = {
// 3D position, 2D texture coordinate
// card front
-0.1, -0.1, 0.0, 1*0.125, 4*0.125, // vertex 0
0.1, -0.1, 0.0, 2*0.125, 4*0.125, // vertex 1
0.1, 0.1, 0.0, 2*0.125, 5*0.125, // vertex 2
-0.1, -0.1, 0.0, 1*0.125, 4*0.125, // vertex 0
0.1, 0.1, 0.0, 2*0.125, 5*0.125, // vertex 2
-0.1, 0.1, 0.0, 1*0.125, 5*0.125, // vertex 3
// card back
0.1, 0.1, 0.0, 4*0.125, 2*0.125, // vertex 2
0.1, -0.1, 0.0, 4*0.125, 1*0.125, // vertex 1
-0.1, -0.1, 0.0, 5*0.125, 1*0.125, // vertex 0
0.1, 0.1, 0.0, 4*0.125, 2*0.125, // vertex 2
-0.1, -0.1, 0.0, 5*0.125, 1*0.125, // vertex 0
-0.1, 0.1, 0.0, 5*0.125, 2*0.125 // vertex 3
};
Then I draw it:
glDrawArrays(GL_TRIANGLES, 0, vertices.size());
What is the correct value for the final parameter of glDrawArrays()? vertices.size() or vertices.size()/5? Both appear to work.
↧