Agnel Kurian
Agnel Kurian

Reputation: 59476

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 LineList 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?

Upvotes: 0

Views: 681

Answers (1)

Goz
Goz

Reputation: 62333

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

Upvotes: 1

Related Questions