View Full Version : What's the formula for number of indices for a vertex array?

09-14-2003, 05:43 AM
Sorry, I should be able to do this but I have coder's block http://www.opengl.org/discussion_boards/ubb/biggrin.gif

I want to use indices into a vertex array to avoid duplication. What I've worked out so far is that for an n*n heightmp:

1. number of unique vertices = n*n
2. number of quads = (n-1)*(n-1)
3. number of triangles = 2 * quads

What I want to know is the general formula for calculating the number of indices required. i.e. for a 3*3 there are 9 unique vertices but 12 indices or for a 4*4 there are 16 unique vertices but 24 indices.


*edit* a breath of fresh air can work wonders. (2*n)*(n-1)

[This message has been edited by swiych (edited 09-14-2003).]

09-16-2003, 04:00 PM
For an mxn map, you will have: