As I said- you can’t do this. You will have to convert your arrays into new vertex and normal array with single index array. For example:
vertex pos array: (1,1,1), (2,2,2), (3,3,3), (4,4,4)
index array (pos): 0, 1, 2, 2, 3, 0
normal array: (5,5,5), (6,6,6)
index array (normal): 0, 0, 0, 1, 1, 0
Vertices 0 and 1 are always used with normal 0.
Vertex 3 is always used with normal 1.
Vertex 2 is used with normal 0 and with normal 1 - that’s why we have to make a duplicate of this vertex.
After conversion:
vertex pos array: (1,1,1), (2,2,2), (3,3,3), (3,3,3), (4,4,4)
normal array: (5,5,5), (5,5,5), (5,5,5), (6,6,6), (6,6,6)
index array: 0, 1, 2, 3, 4, 0
Now you can use it with OpenGL.
As you can see, you have to put every unique pair of vertex and normal vector into final array.
Algorithm is quite simple.
Original index arrays were:
0, 1, 2, 2, 3, 0
and
0, 0, 0, 1, 1, 0
You can write it down as:
0-0, 1-0, 2-0, 2-1, 3-1, 0-0
So, first we have vertex 0 - normal 0. This is our first new element in arrays. We put this vertex and normal into output vertex and normal array and put index 0 into output index array.
Then we have vertex 0 - normal 1. This is different element, so add vertex 0 and normal 1 into our output arrays and we add 1 to output index array.
Then it’s 2-0 - it’s another unique element (#2 in output index array). 2-1 is the same vertex but different normal so it’s another unique element (#3). Then, there’s 3-1 (#4) and then there’s 0-0 which is allready in output vertex and normal array so we just add index #0 to output index array.