instead of m_pLine->Draw(m_lineVertices, m_dwVertCount, color);
but the result is not correct. Actually i m drawing a shape from the vertices. using simply the second appraoch, the shape is drawn correctly but with some additional lines joining other line segments. The loop approach above i used does not draws the whole shape, only some parts. Am i doing it wrong Any idea plz
Unfortunately, it doesn't draw line lists directly. Only strips. However, I'm quite sure it does some sort of internal batching for maximizing effeciency. That is, just loop on ID3DXLine::Draw() with your line segments and they should be batched internally. It's not the best thing for performance of course, but I think this should work fairly well with small numbers of lines (i.e. hundreds).
Drawing line lists using ID3DXLine
Lakshminarayana
///////////////////////////////
for (int i=0; i<m_dwVertCount; i+=2)
{
D3DXVECTOR2 line[2] = { m_lineVertices[ i ], m_lineVertices[i+1] };
m_pLine->Draw(line, 2, color);
}
/////////////////////////////
instead of
m_pLine->Draw(m_lineVertices, m_dwVertCount, color);
but the result is not correct. Actually i m drawing a shape from the vertices. using simply the second appraoch, the shape is drawn correctly but with some additional lines joining other line segments. The loop approach above i used does not draws the whole shape, only some parts. Am i doing it wrong Any idea plz
Thanks
gon2024
It's not the best thing for performance of course, but I think this should work fairly well with small numbers of lines (i.e. hundreds).