Monday, 15 September 2014

c++ - Convert 2d array to 1d array for drawing line -


As the LPD 3D accline accepts only 1D, I convert the 2D array to 1d array. Therefore, I can keep the line drawn on the screen and want to draw another new line.

  D3DXVECTOR2 lineVertices [newLine] for [currentLine] (int i = 0; i & lt; noOfNewLine; i ++) line - & gt; Draw (linewirt [i], 2, d3d caller_xrobj (0, 0, 0));   

If I change

  in line D3DXVECTOR2 [currentLine] [newLine]   

I

  lineVertices [i]   

to successfully convert it to 1d array?

Why do you need to change 2d in 1d? Any array in C \ C ++ is stored in memory as 1d allready, just assign an address to AMS before an indicator

  p = & amp; Lines [0] [0];   

Where p is an indicator for your array type. And then repeat with p

  (int i = 0; i & lt; newLine * currentLine; i ++) {// do stuff with P [i]}    

No comments:

Post a Comment