views:

162

answers:

1

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?

+1  A: 

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 );
Goz
Is there a way to combine all of the above into one single mesh object?
Vulcan Eager
If you mean a D3DXMesh .. no .. D3DXMeshes handle only triangle lists. If you are talking any sort of mesh then sure. It depends how you define your mesh structure.
Goz