generating an index buffer for a given vertex buffer
size_ttextc_index_buffer_size(uint32_tvertex_count) {
return (vertex_count / 4) *6;
}
voidtextc_fill_index_buffer(uint16_t*buffer, size_tcount) {
uint16_tv=0;
for (size_ti=0; i<count; i+=4) {
buffer[i] =v+0;
buffer[i+1] =v+1;
buffer[i+2] =v+2;
buffer[i+3] =v+2;
buffer[i+4] =v+3;
buffer[i+5] =v+0;
}
}
// in other words it's always bunch of quads one after the other, each glyph// is drawn on a quad, and the quads are provided in logical/reading order