How to generate TriStrip? (without the mesh)

Can anyone give me a example of usage of the TriStrip?



I want to create a simple strip of triangles so I assumed using the TriStrip was the best way to go.

I saw this example TestTriangleStrip but they rely on an IndexBuffer that I also don’t know what it is.



So if someone could explain to me how should I order the vertices, what should be the minimum Strip Size and what booleans to turn on before calling the generateStrips method it would be great.

Yeah, both share vertexes. A triangle strip just lets you have a smaller index buffer because you can use fewer indexes to define it. But your mesh would have to be pretty large before this made a speed difference.

@zarch Thank you so much, I hadn’t read that piece of info before.



I’ll start with my indexed triangles then :slight_smile:

Can someone give me hand with this?

It’s really important . . .



The example that uses ModelConverter is not very helpful at all since I don’t know anything about it or model conversion.

You will always need an index buffer, that tells GL in what order to construct the triangles.



This should be a helpful read: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes

Why do you need triangle strips? Just generate regular triangles.

@Momoko_Fan

The triangle strip is easier for me I think since what I want to generate is a strip to start with.



I have a path/line and want to generate a strip to signal that line so I what to show position but also yaw-pitch-roll.

If I keep generating triangles I have to do calculations on what vertice goes where, like this I just need to add the vertices. I think.



Another reason is performance (no repeated vertices).

Well if generating the line you don’t need to generate repeated vertices.

Tri strips have the exact same number of vertexes… only the index buffer is different.

@zarch I didn’t understand what you mean.



@pspeed What I mean by the number of vertices is that (I understood that) if you generate triangles for the mesh if you have two adjacent triangles one with vertices A, B and C and another with B, C and D you would have to send B and C two times and as both triangles and tristrips are primitives, the tristrip would be faster. Could you please explain what you mean by only the index buffer is different?

[java]1—2---5

| / | / |

3—4---6[/java]



Generate 6 points, 4 triangles. - Share the vertices.



Could even do something like:



[java]1


4---6
| ', / ', |
2---3
5[/java]

It all depends what and why you are trying to do.

http://en.wikipedia.org/wiki/Triangle_strip

This says there is no speed advantage to using a tristrip over just using indexed triangle lists.
1 Like