Auto generate vertex and indices for tristrips?

I have been given the the task of quantifying the frame rate of an app as a function of scene complexity. Something like finding FPS(#triangles in scene).

Objects for this app are specified by vertex data for tri strips. For example to specify a quad, you specify that it has a total 4 unique vertices, then give the vertex data, then you have to specify the indices used… e.g. an input file might look like this

Number of vertices


      1. V1

-1. 1. 0. # V2

  1. -1. 0. # V3
    -1. -1. 0. # V4

Coordinate Indices

2 # 2 Tri-strips
0 1 2 # use vertices 0,1,2
2 1 3 # use vertices 2,1,3

I want to generate input files with varying numbers of tri-strip vertices for a quad to test the FPS vs. tris. But I don’t want to have to manually create each file, so I was curious if there was an alorithm I could use to generate the verts and indices. Maybe something that will let me specify x and y extent and the number of verts horiztonally and vertically, the the output being a list of vertices and a list of index triples.

Maybe someone knows of an example that does this sort of thing?


So you just want to generate a quad? Vertices are easily generated, you just compute their position on a grid (you should be able to do it without additional hints). Indices are also easy: I recommend you to take a sheet of paper and draw a vertex grid on it – then you will sonn find out how to place indices to get a tristrip.

Hope it helped (I am not in mood to write the algorithms for you unfortunately, but it is really easy).

Before you start measuring performance of tri-strips, read:
Strippers, Linear speed vertex cache optimization.