Hi.
I want to create a custom 3d mesh procedurally. I made two different approaches, just for the debugging. The first one works fine, but it is only for debugging purposes and I cant and must not use in the final source code. The second doesnt work as intended, and I cant understand why. Here is the explanation:
The first method makes a triangle in every iteration by evaluating its vertices, immediately makes a mesh from it by putting the 3 vertices into an index buffer, makes geometry from it and finally renders it. By the end of all the iterations, we will practically have X number of triangle-shaped geometries which forms the final mesh.
The second method generated all the triangles, puts all the indices in an index buffer (in the order of generation), and after all the iterations we create a mesh based on this buffer and render it.
The problem here is, if we assume that we have generated vertices (0,1,2,3,4,5…) in this order, then I want the triangles to be (0,1,2), (3,4,5), (6,7,8) which works in the first method, but in the second method I get triangles (0,1,2), (1,2,3), (2,3,4), (3,4,5)…even if I define the index buffer as (0,1,2, 3,4,5, 6,7,8, …).
ps: yes, I have read the custom mesh tutorial many times, but it doesnt help