Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Imagine having a 4x4 square, with 16 smaller squares inside of it, with associated data on what the squares should look like (ie., opacity, colour, etc...).

Is there an existing, efficient, algorithm, for converting this set of squares into an open-gl compatible triangle strip?

share|improve this question
up vote 4 down vote accepted

Firstly, I'd suggest that if your primitives (the squares) have different appearances, especially opacity, then tri-stripping may not make sense (i.e. the vertices aren't really shared).

Secondly, these days you're probably better off with indexed geometry, rather than an actual tri-strip, so consider going that route.

Finally, if you really want to generate a tri-strip, have a look at nvtristrip, which is available from nVidia:


(indeed, it will also generate efficient indexed lists, so look at it regardless).

share|improve this answer
Based on my current, probably flawed, understanding of opengl graphics, opacity is a property that's applied to the middle of a shape rather than its vertices. Is this false? Is there a tutorial or document where I can better learn this stuff? – blueberryfields Oct 19 '10 at 16:22
Opacity is controlled via alpha-blending. Supply a value for the alpha can be done through vertices, through texturing, or using shaders (or a combination). Which is best for you depends exactly on what you're doing. – JasonD Oct 19 '10 at 16:33

This is a trivial problem if you are able/willing to link strips with degenerate triangles - as most stripping algorithms do anyway.

Each Nx1 row of squares is a very simple triangle strip. For each row, you want to start a new strip.

Simply duplicate the last vertex of strip 1 and the first vertex of strip 2, and that will create a degenerate polygon linking the two strips

(However, if as your question indicates, the vertices are not shared between the squares - different colours/UVs etc, then you don't want to use strips)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.