For one, you can't initialize normals[] to an array whose elements are function calls; you'll have to give it a static size and insert the CrossProduct() return values in code. (Unless this is some screwy non-C, non-C++ language, or I'm misremembering what you can use as an array initializer. Either is possible.)
But second, if I understand what you're trying to do, you're trying to pass OpenGL a separate array of vertices, then a separate array of indices into that vertex array, instead of passing a huge array of (repeated) vertices? In that case, you don't have the CrossProduct() results in your vertexes[] array, so you can't do that. Since CrossProduct(vertexes[0], vertexes[4]) (for instance) is not in vertexes[], you can't put its index into faceData.
I'd take your normals[] array (after normalization), append its elements into vertexes[] (this is where STL comes in handy in C++, though you might be able to figure out a good way to do it statically), and then put the appropriate indices into faceData in the proper place (wherever OpenGL is expecting the normal vectors). |