Hey all,
I’m programming this little benchmark for linux to test out the different methods of precompiling the vertex data.
I’m rendering bunch of cubes to the screen, and each face on the cube has only one normal.
I want to draw them using vertex buffer arrays, so far my code looks like the following, it is obviously wrong, as it will be looking for a normal for each vertex, and runs out of data, as well as the normals being all screwed up.
cube_mesh.vertex_qty = VertexQty;
cube_mesh.vertex = malloc(VertexQty * 3 * sizeof(float));
cube_mesh.texture = malloc(VertexQty * 2 * sizeof(float));
cube_mesh.normal = malloc(VertexQty / 4 * 3 * sizeof(float));
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, cube_mesh.vertex);
glNormalPointer(GL_FLOAT, 0, cube_mesh.normal);
glDrawArrays(GL_QUADS, 0, cube_mesh.vertex_qty);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
So, it will render, but not what I want.
Is there anything I can do?
Thanks in advance