开发者

Direct3D Mesh with combination of lines and triangles

I need to create a Direct3D mesh consisting of some vertices (generated at run-time) which I need rendered as a combination of LineLi开发者_Go百科st and TriangleList. i.e. some vertices are rendered as a LineList and some of them as a TriangleList.

How can I create this Direct3D mesh?


Well create a vertex buffer and put all the verts in it.

Next create an index buffer. Put the line list indices in there. Next add the triangle list indices to the index buffer.

Finally .. render, something like as follows:

pDevice->DrawIndexedPrimitive( D3DPT_LINELIST, 0, 0, numLineIndices, 0, numLineIndices / 2 );
pDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, numTriangleIndices, 0, numTriangleIndices / 3 );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜