# Understanding Triangle Strips

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

## Recommended Posts

I want to implement Triangle Strips into my engine, under a VBO architecture. From what I understand, each new vertex you add creates a triangle formed by it, and the last two added. I need tristrip models, so to that effect, I'm using Stripe to stripify my existing 3D model library. I export them into .obj format, run Stripe on them, and re-import them. My current problem lies in that I don't understand Stripe's file format, and that may come from not understanding stripes completely. Here is a sample output produced by Stripe:
      v 0.000000  0.000000 1.000000    # Vertex 1
v 1.000000  1.000000 0.000000    # Vertex 2
v 2.000000  0.000000 0.000000    # Vertex 3
v 3.000000  1.000000 0.000000    # Vertex 4
v 4.000000  0.000000 0.000000    # Vertex 5
v 3.000000 -1.000000 0.000000    # Vertex 6
v 4.000000 -1.000000 0.000000    # Vertex 7
v 2.000000  2.000000 0.000000    # Vertex 8
v 3.000000  2.000000 0.000000    # Vertex 9
v 3.000000  3.000000 0.000000    # Vertex 10

t 10 9 8     # Start of triangle strip 1
q 4          # Continuation of triangle strip 1
q 2          # Continuation of triangle strip 1
q 3 1        # Continuation of triangle strip 1

t 3 4 3 5    # Start of triangle strip 2
q 6 7        # Continuation of triangle strip 2


Stripe's documentation describes: t - triangle strip q - triangle strip continuation My question is, shouldnt every tristrip start with a "t" and only 3 values? Shouldnt every "q" be a single value? What do those extra digits mean? And how do I represent those in a data structure to a VBO? Do I need a VBO Buffer per strip, which would mean several per mesh? Thanks for any help on this...

##### Share on other sites
On the downloads section of the stripe website you can download a viewer. It comes with source. I suggest looking in there to see how they handle things. (sorry, I'm just too lazy to bother with it myself right now)

##### Share on other sites
Quote:
 Original post by wendigo23On the downloads section of the stripe website you can download a viewer. It comes with source. I suggest looking in there to see how they handle things. (sorry, I'm just too lazy to bother with it myself right now)

I'd rather not, not that I'm lazy, but that wouldnt give me the answers i'm looking for.

What I need to know is the requirements for using Triangle Strips under VBOs, under OpenGL, and, looking at the export format seen above, how would I go by converting it to something binary I could send to the graphics card.

Thank you.

##### Share on other sites
AFAIK, VBOs are exactly the same as regular vertex arrays, except that they're stored in a more easily accessible (for the graphics card) location. What this means is that you can put several strips into the same buffer, and specify which set of indices to take using the render call. I think you need separate buffers for the vertices and for the indices though. I suggest you have a look at the OpenGL specification (found at www.opengl.org) to find a list of relevant functions and how to use them.

In general (VBOs or not), trinagle strips are specified as a list of vertices, where the first three specify the first traingle, and after that each extra vertex specifies another triangle with the help of the previous two vertices.

As for Stripe's output, what it gives you is the data for an indexed triangle srtip. The v's are the vertex positions, and the t's and q's are the indices into the v list. I'm not familiar with the format, but I'm guessing that the division into t's and q's is rather arbitrary, based on some internal considerations (e.g. ease of output), so you should just concat the q's after each t in order. In other words, I think that the strip output you posted is equivalent to:

strip 1: 10 9 8 4 2 3 1 (tqqq)
strip 2: 3 4 3 5 6 7 (tq)

• 48
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631374
• Total Posts
2999654
×