indexed lists with more normals than vertices?

Hi,
Is it possible to use vertex arrays / indexed lists (e.g. glDrawElements or some version of it) when I have a triangle mesh with a different number of normals and vertices?

Take a simple example: a cube has 6 faces (12 triangles) and 8 vertices. But we actually have 6 unique normal directions (one in each direction of the faces of the cube).

So if vertices and normals are each represented as 3 floats, then the vertex array would have 83 = 24 floats, and the normal array would have 63 = 18 floats. For proper rendering, each vertex needs to be drawn three times (each time with a different normal) because each vertex is shared by three faces, each with its own normal.

Is there a way to set up indexed lists / vertex arrays to do this? It could be done by replicating the vertex data, but this seems like a waste.

Thanks,
Eric

You can’t have separate index arrays for vertices and normals, so you have to duplicate vertices/normals. A cube, for example, requires 24 vertices and normals.

If you use a flat shading model, I think you’ll just need 8 vertices and 8 normals, each normal corresponding to the last vertex of each face.

But if you want to do texturing, you’ll have to duplicate vertices.

It turns out that for decent-sized meshes (a cube is not decent-sized) the overhead of sending extra indices for texture coordinates, normals, and vertice separately, bloats the model data so it’s bigger than just generating normalized unified vertices and a single index list.

For a suggestion on how to transform model-application style data (separate indices/arrays) to hardware data (unified) see http://www.mindcontrol.org/~hplus/graphics/vertex-arrays.html