#### Archived

This topic is now archived and is closed to further replies.

# Convex polygon to triangle strip

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

## Recommended Posts

Has anyone got any idea on how to generate a triangle strip from a convex polygon, while preserving clockwise vertex order, for backface culling?

Looking for a serious game project?
www.xgameproject.com

##### Share on other sites
Isn''t this absolutely straight-forward?

##### Share on other sites

How do you convert an n-sided convex polygon with the vertices ordered clockwise to a triangle strip with the first triangle ordered clockwise.

Looking for a serious game project?
www.xgameproject.com

##### Share on other sites
assume your vertices are numbered v[0] ... v[n-1],

int i = 1;
int j = n-1;
bool left = false;

while (i < j)
{
if (left)
{
i++
}
else
{
j--;
}
left = !left;
}

haven''t tested it, but the idea is that you keep 2 running indices i and j. i increases and j decreases and you always alternate between i and j.

This should work with both clockwise and counterclockwise ordered vertices.

##### Share on other sites
For CW, the idea is like this, according to how OpenGL draws its tri-strips. For CCW, mirror the drawing:

2-----3 2-----4
/ \ /| /|\
/ \ / | / | \
1 4 ---> 1 | / | 6
\ / \ | / | /
\ / \|/ |/
6-----5 3-----5

Michael K.,
Co-designer and Graphics Programmer of "The Keepers"

We come in peace... surrender or die!