# DX10: TriangleStrip restart

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

## Recommended Posts

Hello, I tried to render a terrain with a indexed trianglestrips. My vertex grid looks like this (9 vertices):
6----7----8
|    |    |
3----4----5
|    |    |
|----|----|
0    1    2

The indices for the upper row are: 0, 3, 1, 4, 2, 5 Now I want to continue with the upper row but obviously this isnt possible. So I tried to generate a degenerated triangle to restart the strip by adding 5 a second time to the indexbuffer: 0, 3, 1, 4, 2, 5, 5 Now I continued with the upperrow: 0, 3, 1, 4, 2, 5, 5, 3, 6, 4, 7, ... But if I render the grid it looks strange so obviously there is something wrong with my "degenerated" triangle. What did I do wrong? Doesnt repeating an index restart the strip? If not: how can I continue with row 2?

##### Share on other sites
Creating a single degenerate triangle won't restart the strip. A triangle strip contains a triangle for every 3 consecutive vertices. So your triangle strip generates the triangle 5,3,6, which of course is wrong. One solution is to duplicate the first vertex of the next row as well.

##### Share on other sites
Yup, in order to restart your strip you need to duplicate the last index of the first strip and the first vertex of the second strip.

-- OR --

Insert an index with the value 0xFFFF and take advantage of this neat new feature of DirectX 10 [smile]

Also, if your terrain mesh has dimensions row x colums and rows < colums, you should try to render in colums order instead of row order so that repeating indices be as close as possible to each other, possibly taking better advantage of the post-transform vertex cache. It's just a guess, it could quite as well make no differene at all (or be worse since you'd have more "strip reatarting" and/or degenerates triangles)

JA

##### Share on other sites
Do you mean adding 0xFFFF in the indexbuffer restars the strip?

So in my case: 0, 3, 1, 4, 2, 5, 0xFFFF, 3, 6, 4, 7, ... ?
I tried that but it still doesnt work: http://www.infoboard.org/screenshots/tristrip.png

I tried to search about the 0xFFFF DX SDK Docu but I didnt find anything...

##### Share on other sites
Strange..
This is a quote from my SDK's doc (April 2007)

Quote:
 ID3D10Device::CreateBuffer...Multiple line or triangle strips can be defined in a single index buffer. Setting an index to the maximum possible value (0xffff for a 16-bit index, 0xffffffff for a 32-bit index) indicates the end of one strip and the beginning of another strip.

##### Share on other sites
Quote:
 Original post by jantaIt's just a guess, it could quite as well make no differene at all (or be worse since you'd have more "strip reatarting" and/or degenerates triangles)
It'll make no apparent difference to vertex cache hit rates. If you actually want to optimize that, you'll need to use columns of short strips.

• 11
• 20
• 12
• 10
• 35
• ### Forum Statistics

• Total Topics
631399
• Total Posts
2999857
×

## Important Information

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!