- /* TODO: Can do top and bottom as Triangle strip as well
- (just need to repeat top/btoom vertex a lot). Then we can draw
- the whole thing with just one index array and one for-looped call
- to glDrawElements.. That'll make it easier to reuse code with other
- Circular objects too
- */
- topIdx[0]=0;
- topIdx[1] = 1; /* repeat first slice's idx for closing off shape */
- for (j=slices, idx=2; j>0; j--, idx++)
- topIdx[idx] = j;
-
- bottomIdx[0]=nVert-1; /* zero based index, last element in array... */
- for (j=0, idx=1; j<slices; j++, idx++)
- bottomIdx[idx] = nVert-(slices+1)+j;
- bottomIdx[idx] = nVert-(slices+1); /* repeat first slice's idx for closing off shape */
+ /* top stack */
+ for (j=0, idx=0; j<slices; j++, idx+=2)
+ {
+ stripIdx[idx ] = j+1; /* 0 is top vertex, 1 is first for first stack */
+ stripIdx[idx+1] = 0;
+ }
+ stripIdx[idx ] = 1; /* repeat first slice's idx for closing off shape */
+ stripIdx[idx+1] = 0;
+ idx+=2;