Sign in to follow this  

Algorithm to auto generate vertex/index data for tri strip object?

This topic is 3464 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 4 1. 1. 0. # 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? Thanks, CB

Share this post


Link to post
Share on other sites
You mean something like this?:

7--8--9

|\ |\ |

| \| \|

4--5--6

|\ |\ |

| \| \|

1--2--3


For this just build each row or column as a trilist, i.e. alternating one up/down and one right/left:

1,4,2,5,3,6 and 9,6,8,5,7,4

To create a single strip you need to stitch them together with degenerate triangles, i.e. triangles with no area (they have only 2 distinct vertices):

3,6,6 + 6,6,9 + 6,9,6, so basically, just add one more index between the rows:

1,4,2,5,3,6,6,9,6,8,5,7,4

Or use NvTriStrip for that purpose. That programm works on arbitrary polygon soups.

Share this post


Link to post
Share on other sites

This topic is 3464 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this