meshbuilder->CreateMesh( &mesh );
I added it to the scene and I tried to change the vertices using the SetVertices function. The problem is after doing so, everything works as it should, except the mesh is pitch black, even with the lights and everything. You can just see the silhoutte of the mesh.
what I did was:
D3DRMVERTEX vertices[3000];
. . . //put vertex positions in vertices[]
mesh->SetVertices(0, 0, vertnum, vertices);
But when I change the
D3DRMVERTEX vertices[3000];
to
D3DRMVERTEX *vertices = (D3DRMVERTEX *)malloc(sizeof(D3DRMVERTEX) * vertnum);
and then do the SetVertex call, it works better, but now it has flashy black and white alternating colours swirling around the mesh.
I have no idea what's wrong, the mesh should be white, and it is if I don't call the SetVertices function, but I need to change vertex positions often so I used D3DRMMESH instead of Meshbuilder.
When I set only a portion of the mesh vetices with the SetVertices function, those vertices are turned black, but the rest is white.
Please help, I don't know why the mesh turns pitch black or swirls with alternating black and white colours when I call the SetVertices function.
Thanks very much,