#### Archived

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

# (un)connected triangle-Strips ?

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

## Recommended Posts

Hello, some thoughts for which I seek confirmation (or not). To increase performance it''s better to render one big vertexbuffer with one DrawPrimitive call than to render this same number of vertices in multiple DrawPrimitive calls. Keeping this is mind, one should try to add as much as possible triangle-strips into one vertex buffer and render this complete buffer with one call. However I can not imagine this will work because all the triangle-strips will be connected to each other, because the start end end of each strip is lost. So eacht strip has to be rendered with a separate DrawPrimitive call. Am I right ?, if not what''s wrong ? Arie.

##### Share on other sites
Well, thats the reason a lot of people switch to indexec buffers :-)

Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)

##### Share on other sites
You can use what are called degenerate triangles in your strips.

Basically if you have 2 strips which don''t physically join up, you just join them using a triangle with 2 vertices sharing the same position in space.

This makes the triangle infinitely thin, and so it is never drawn.

It''s quite a common technique, and works very well.

- Pete

How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

##### Share on other sites
Hi,

what you have to use are those "degenerated triangles".

Degenerated triangles are triangles that do not have
a visible surface. Let's take an example :

Your triangle strip looks like this :

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

making triangle 0,1,2 then 1,2,3 then 2,3,4...

you have a second triangle strip that you want
to stitch behind the first one, so the count
looks like this :

9,10,11,12,13,14,15

making triangle 9,10,11 then 10,11,12 then 12,13,14...

Your problem ist to put those 2 strips into one.

you have to connect the last triangle of strip #1
to the first triangle of strip #2.

the obvious following numbers are then :

...,6,7,8,9,10,11,...

but this make us have a triangle 7,8,9 and a
triangle 8,9,10 between the last triangle of strip #1
and the first triangle of strip #2.

To avoid that, we have to create a degenerated
triangle by inserting one of the indices a second
time. I prefer to take the last index of the
new strip.

So, the index sequence looks like this now :

...,5,6,7,8,8,9,10,11,...

making following triangles :

5,6,7 then 6,7,8 (last of strip #1) then
7,8,8 then 8,8,9 then 8,9,10 (first of
strip #2).

The triangles 7,8,8 and 8,8,9 are 2 degenerated
triangles with no surface which are rejected very
fast on current hardware.

I hope this helps...

Metron

[edited by - Metron on September 12, 2002 11:41:55 AM]

##### Share on other sites
If you're using a tri strip, surely you actually add 3 invisible triangles. You duplicate a vertex and get an invisible one at the first end, add another to move to the new start point, then add a third in setting up the 2nd start point for the new strip?

In your example you generate the triangle 8,9,10, which spans between the two strips you want separate. Surely the order should be ...6,7,8,8, 9,9,10,11...

Edit: actually you get 4 degenerate tri's with this method if i'm correct, not 2 as suggested.

[edited by - OrangyTang on September 12, 2002 12:09:33 PM]

##### Share on other sites
Hmmm... why 4 ? Is my counting wrong ?

5,6,7,8,8,9,10,11

5,6,7
6,7,8
7,8,8
8,8,9
8,9,10

Jepp.. You''re right... I forgot 1... strange...

Sorry...

##### Share on other sites
Pete and Metron, thanks for that tip! I had never thought of it. Although I have been using triangle lists, I'm going to rethink what I've been doing now considering that trick.

[edited by - JimH on September 12, 2002 4:30:05 PM]

1. 1
2. 2
Rutin
17
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633735
• Total Posts
3013596
×