2012-08-28 61 views
1

來自Nvidia使用NvTriStrip庫, http://www.nvidia.in/object/nvtristrip_library.htmlNvTriStripe:生成條紋重複的指標

我試圖用NVTriStriper從三角形索引創建三角形條紋。但是,似乎並不完美。

以下是輸入索引,

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); 

生成的輸出,

NbGroups = 1 
(*pPrimitiveGroup).numIndices = 101 

和條指標如下,

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} 

現在,有了這一點,你可以看到,有三角形的索引如(56,8,8),這會導致渲染線條而不是三角形。

有人知道NVTriStrip中存在這樣的問題嗎?

+0

條紋是交替的顏色帶。小條(不是「e」)就是你實際上在談論的東西。 –

回答

1

有三角形的索引如(56,8,8),這會導致渲染線條而不是三角形。

不,它們會導致渲染什麼。三角形光柵渲染器呈現三角形的區域;由2個點組成的三角形沒有區域,因此沒有渲染。

是的,這是預期的。這就是NVTriStrip 的工作原理。這是一種常見的稱爲「拼接」的技術:多個三角形條與退化三角形(無區域的三角形)連接在一起。這可以讓你通過一個glDrawElements呼叫(或者DrawIndexedPrimitive,如果你使用的話)來繪製整個模型。

+0

謝謝,這有幫助。 – Subhransu