GLfloat vertices[] = {...}; // 8 of vertex coords
GLubyte indices[] = {0,1,2,3, // 24 of indices
0,3,4,5,
0,5,6,1,
1,6,7,2,
7,4,3,2,
4,7,6,5};
I use glDrawElements() function to render GL_QUADS and everything is ok.
But what if I want to add normal array to my object? What structure does it have to be?
3 floats for every index (one Normal for every Vertex)?
or 3 floats for every 4 of indexes (one Normal for every Quad) ?
Or should I use glDrawElements() function not once, but for every Quad separetely, giving property amount of indices?
I want to have one normal per polygon. In your description there is one normal per every vertex.
For example:
Polygon A consists of vertex indexes: 0, 1, 2, 3
Polygon B consists of vertex indexes: 1, 4, 5, 6
All vertices in polygon A should have normal nA, and all vertices in polygon B should have normal nB.
We can see, that vertex number 1 is common to Polygon A and Polygon B. I would like to set normal nA to vertex number 1 when I render polygon A, and normal nB to vertex number 1 when I render polygon B.
Is there any possibilty to set different normal to every element of Index Array?