I'm creating an app using VBO to render some objects with difficult color structure. I noticed, that VBO defines the color of the element equal to last vertex index in the element buffer. For example, when I use point array like this
double pointBuf[]={ -0.1d, 0.1d, 0,
0.1d, 0.1d, 0,
0.1d, -0.1d, 0};
color array:
double colorBuf[] = { 0d, 1d, 0d,
0d, 1d, 0d,
1d, 0d, 0d};
and element array:
int elementBuf[] = {0, 1, 2};
to draw a triangle, it will be red (as the last element in elementBuf is 2, in colorBuf it matches red).
In fact it can lead to additional memory usage to paint everything correctly.
Is there any other possible way to link colors with elements?