1

Using NvTriStrip library from Nvidia, http://www.nvidia.in/object/nvtristrip_library.html

I was trying to use NVTriStriper for creating triangle stripes from triangle indices. But, seems it does not work perfectly.

The following is the input indices,

PrimitiveGroup *pPrimitiveGroup = NULL;
uint16 NbGroups;
uint16 ind[] = {1, 2, 3, 1, 3, 4, 0, 1, 4, 5, 0, 4, 61, 0, 5, 60, 61, 5, 59, 60, 5, 59, 5, 6, 6, 58, 59, 57, 58, 6, 7, 57, 6, 56, 57, 7, 8, 56, 7, 21, 56, 8, 21, 8, 9, 9, 20, 21, 19, 20, 9, 18, 19, 9, 18, 9, 10, 18, 10, 17, 11, 17, 10, 16, 17, 11, 16, 11, 15, 15, 11, 12, 15, 12, 14, 14, 12, 13, 21, 22, 56, 22, 55, 56, 22, 54, 55, 23, 54, 22, 53, 54, 23, 53, 23, 24, 52, 53, 24, 36, 52, 24, 36, 24, 25, 35, 36, 25, 25, 26, 35, 27, 35, 26, 27, 34, 35, 34, 27, 33, 33, 27, 28, 32, 33, 28, 31, 32, 28, 28, 30, 31, 30, 28, 29, 51, 52, 36, 37, 51, 36, 37, 50, 51, 37, 49, 50, 37, 48, 49, 48, 37, 38, 48, 38, 47, 39, 47, 38, 47, 39, 46, 46, 39, 45, 45, 39, 40, 44, 45, 40, 44, 40, 41, 43, 44, 41, 43, 41, 42};
uint16 count=180;
GenerateStrips(ind, count, &pPrimitiveGroup, &NbGroups, true);

The output generated is,

NbGroups = 1
(*pPrimitiveGroup).numIndices = 101

And stripe indices as follows,

outputIndices={10, 10, 17, 11, 16, 11, 15, 12, 14, 13, 13, 54, 54, 54, 22, 55, 22, 56, 21, 8, 21, 9, 20, 9, 19, 9, 18, 10, 17, 17, 2, 2, 2, 3, 1, 4, 0, 5, 61, 5, 60, 5, 59, 6, 58, 6, 57, 7, 56, 8, 8, 24, 24, 24, 36, 25, 35, 26, 35, 27, 34, 27, 33, 28, 32, 28, 31, 28, 30, 29, 29, 42, 42, 43, 41, 44, 40, 45, 39, 46, 39, 47, 38, 48, 37, 37, 48, 48, 37, 49, 37, 50, 37, 51, 36, 52, 24, 53, 23, 54, 22}

Now, with this out as you can see, there are triangles with indices such as (56, 8, 8), this results in rendering lines and not triangles.

Anyone aware of such problems in NVTriStrip?

4

1 回答 1

1

there are triangles with indices such as (56, 8, 8), this results in rendering lines and not triangles.

No, they result in rendering nothing. The triangle rasterizer renders the area of a triangle; a triangle composed of 2 points has no area and therefore is not rendered.

And yes, this is expected. That's how NVTriStrip works. This is a common technique called "stitching": multiple triangle strips are tied together with degenerate triangles (triangles with no area). This is what allows you to draw the entire model with a single glDrawElements call (or DrawIndexedPrimitive, if you use that).

于 2012-08-28T10:19:25.697 回答